Page 1 of 1

Newbie-Prob

Posted: Thu Jul 04, 2002 8:19 am
by Thanatos
Hi,
my prob is the following:

$result = mysql_query("SELECT * FROM week WHERE id = 1")
or die (mysql_error());

This gives me " Resource id #2", but what I want to have is the content of the row with id 1.

What did I make wrong?

Greets
Thanatos

Posted: Thu Jul 04, 2002 8:31 am
by twigletmac
$result is a result resource to get the information you are looking for you have to go one step further:

Code: Select all

$info = mysql_fetch_assoc($result);
Then you can work with $info because it is an associative array full of all the data from your table:

Code: Select all

foreach ($info as $field => $value) {
    echo $field.' = '.$value.'<br />';
&#125;
This will show you all the info in the first row of the result. For more information check out mysql_fetch_assoc() in the manual.

Mac

Posted: Thu Jul 04, 2002 8:56 am
by Thanatos
Cool. It works...

Thanks a lot !