For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > April 2004 > What's the problem with this script?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author What's the problem with this script?
marito

2004-04-10, 5:33 pm

Hi there! I just registered on this forum. I was trying to acces a
database that I recently created, this is my first time ever!.
There syms to be a problem with the script

<?php
db =
mysql_connect("localhost","root","pass");

mysql_select_db("mybuddy",db);
//replace the above values with your actual database values

sql_result = mysql_query("SELECT joke_no, joke FROM
jokes", db);

while(rs = mysql_fetch_array(sql_result))
{
echo "Joke No: rs[0]<BR>";
echo
str_replace("n","<BR>",rs[1]);
echo "<P>";
}
?>
I used the root and
password from my localhost.
This is the error I get when trying to connect
Warning: mysql_fetch_array(): supplied argument is not a valid
MySQL result
resource in /home/fstoresc/public_html/php/jokes.php on
line 17
Any
suggestions? Thank you





----------------------------------------
The
post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


trax

2004-04-12, 11:33 am

there can be that u didn't created a data base in the right way...
or you just misstyped it's name

"Why don't you use Lunix, they're much more reliable than
those crapy windows"

----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com