Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

can some on take a look at this code?

General discussions related to php

Moderators: macek, egami, gesf

can some on take a look at this code?

Postby gat » Thu May 01, 2003 6:06 am

I get the error

------------------
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\program files\apache group\apache\htdocs\ky\walls.php on line 197
-----------------

and the code look like

-----------------------------
<?php

$conn= @mysql_connect("localhost","*****","*******")
or die("Err:Conn");

$rs= @mysql_select_db("kriminalyouth", $conn)
or die("Err:Db");

$query = mysql_query ( "SELECT COUNT (*)AS number FROM walls_berks") ;

list($count) = mysql_fetch_array($query);

echo "there are " . $count . " images in the table";

?>
---------------------------

many many thanks in advance
gat
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Apr 02, 2003 4:27 am

Postby liquedus » Thu May 01, 2003 6:31 am

i would put something like

if(!$query) print "MySQL error " . mysql_error();

after mysql_query()

if there is a problem with your query this would show it. which is line 197?
liquedus
php-forum Active User
php-forum Active User
 
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada

Postby gat » Thu May 01, 2003 6:32 am

197 = list($count) = mysql_fetch_array($query);

hope this helps.
gat
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Apr 02, 2003 4:27 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.