Jump to content

Archived

This topic is now archived and is closed to further replies.

chuddyuk

displaying results problem

Recommended Posts

this is my code

[code]
<?php

mysql_connect("localhost","********","***********");
    
//select which database you want to edit
mysql_select_db("grange");


$result = @mysql_query("select * from gallery");


while($r=@mysql_fetch_array($result))
{    

  
   $id=$r["id"];
   $name=$r["name"];
   $who=$r["src"];

  

   echo "$id <br> $name <br> $src ";
}

?>
[/code]

Nothing is showing up at all, no errors. when i remove the "@"s then i start getting errors like:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/chuddyuk/public_html/grange/gallery/index.php on line 12

but i cant understand this. ive done this loads of times and its worked. anyone know y nothing shows up now?

any help is much appriciated!!!



Share this post


Link to post
Share on other sites
The @ symbol is error suppression and should be used EXTREMLY sparingly, unlike what you have there. You should be using "or die("some message")" after mysql_query calls.

That error is the result of a bad SQL query. Maybe you don't have a table called gallery or maybe you're not connected to the database.

You might want to read the "annoying errors" section of the FAQ found in the BIG RED LINK in my signature.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.