Welcome Guest [Log In] [Register]
Add Reply
Need help; Display rows from my database
Topic Started: Mar 30 2009, 04:29 AM (301 Views)
kryssy23
Member Avatar

Hey everyone,
I am trying to make a very basic tipping site for my familyto use. I have the first round in the database but i can seem to get the results printed on the page.

I have tried to read the mysql_fetch_assoc section on php.net but i dont really understand what they are trying to say. if anyone could help that would be great :D

Code:
 
<?php
$sql = "SELECT homeTeam,awayTeam FROM round1";

$results = mysql_query($sql, $dbh) or die (mysql_errno($dbh) . ":" . mysql_error($dbh) );

$row = mysql_fetch_assoc($results);

echo $row;
?>


Thanksin advanced :)
Offline Profile Quote Post Goto Top
 
Darksorrow131

$row = mysql_fetch_assoc($results); gives you a row of the data, where you can extract each column by its name - in your case, $row['homeTeam'] would give the value of the homeTeam column.

$row = mysql_fetch_row($results); gives you a row of the data as well, but you don't get to use the column names; instead you will need to do $row[0] and $row[1] which would give the 1st and 2nd columns.

$row = mysql_fetch_array($results); allows you to use both $row['homeTeam'] and $row[0] for the same result.
(let loop () (loop))
((lambda (x) (x x)) (lambda (x) (x x)))
(let ((k #f)) (call/cc (lambda (cc) (set! k cc)) (k))
((call/cc call/cc) (call/cc call/cc))

-- Infinite loops are awesome! --
Tell me if you have other awesome infinite loops!
Offline Profile Quote Post Goto Top
 
Knight13

0
Edited by Knight13, Mar 20 2010, 07:40 PM.
Offline Profile Quote Post Goto Top
 
kryssy23
Member Avatar

yer i think they should or at least have a few examples with explanations or something...maybe even a video could help
Offline Profile Quote Post Goto Top
 
PauloMillerz
Member Avatar

Knight13
Mar 31 2009, 01:30 AM
I do not know what it is about php.net but half the stuff they teach i do not understand i think they should explain things simpler for people who are brand new to php.
yea if i need a tutorial or a description of something in PHP, that webby is the first one i IGNORE!! lol
If you like... RATE IT!! Add to my reputation to the left?
Quote:
 
Bidet to you sir!

Posted Image
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Web-Based Programming Support · Next Topic »
Add Reply

Banner and Logo by TheKeith