RE: [PHP] MySQL error
| From: | Craig Thomas | Date: | Thu, 12 Dec 2002 23:31:02 +0000 |
| Subject: | RE: [PHP] MySQL error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128097@lists.php.net to get a copy of this message | ||
>> $mysql_result = mysql_query($query, $mysql_link);
I am not sure if this is your only problem or not, but mysql_result(); is a
function in php. Using a function name as a variable seems like it will
just lead to confusion to me. I'd try to avoid it.
>>--> line 36 while($row = mysql_fetch_row($mysql_result))
Anyway, where do you define $row?
HTH
-Craig
>>-----Original Message-----
>>From: GWAD Mailinglist [mailto:mailinglist@gwad.net]
>>Sent: Thursday, December 12, 2002 6:01 PM
>>To: php-general@lists.php.net
>>Subject: [PHP] MySQL error
>>
>>
>>Hi,
>>
>>I have following problem:
>>
>>list.php3
>>
>><?
>>
>> // connect to db
>> include("connect_db.php3");
>>
>> // get everything from catalog table
>>
>> $query = "SELECT * FROM yritykset ORDER BY ynimi ASC";
>>
>> $mysql_result = mysql_query($query, $mysql_link);
>>
>> // get each row
>>
>>--> line 36 while($row = mysql_fetch_row($mysql_result))
>>
>> {
>>
>> //get columns
>>
>> $id = $row[0];
>> $ynimi = $row[1];
>> $ylahi = $row[2];
>> $ypostios = $row[3];
>> $ypostitmp = $row[11];
>>
>> print("<TABLE WIDTH=\"750\" BORDER=\"0\">\n");
>> print("<TR>\n");
>>
>> print("<TD WIDTH=\"550\">$ynimi, $ylahi, $ypostios
>>$ypostitmp<TD>\n");
>> print("<TD WIDTH=\"200\"><A
>>HREF=\"tarkenna.php3?id=$id\">MUOKKAA></A> - <A
>>HREF=\"poista.php3?id=$id\">POISTA></A><TD>");
>>
>> print("</TR>\n");
>> print("</TABLE>\n");
>>
>> }
>>
>> // disconnect
>> mysql_close($mysql_link);
>>?>
>>
>>when run, i'll following error messages:
>>
>>Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
>>result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3
>>on line 36
>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>