Jump to content

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!!!



Link to comment
https://forums.phpfreaks.com/topic/11903-displaying-results-problem/
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.