Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Please help?? Warning: mysql_fetch_row()

Codes here !

Moderators: macek, egami, gesf

Please help?? Warning: mysql_fetch_row()

Postby t_davisjr » Sun Mar 30, 2003 6:37 pm

I have been stuck on this for a couple of days now...my code is pretty simple but i just can't seem to get things up and running. I am getting this error:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\program files\apache group\apache\htdocs\php\show_more_db.php on line 7


using this php code:

<?php
//show_more_db.php
include "./common_db.inc";

$sql_select = "SELECT * FROM user";
$result = mysql_query($sql_select);
while($query_data = mysql_fetch_row($result))
{
echo "'",$query_data[1],"' is also known as ",$query_data[3],"<P>";

};
?>

I got this code right out of the book...everything worked well up to this point. Any clue to whats going on?? :?
t_davisjr
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sun Mar 30, 2003 5:47 pm

Postby Oleg Butuzov » Sun Mar 30, 2003 11:45 pm

common_db.inc
in thi file you must put all info about connecting to db.
for exemple

Code: Select all
$user="pejone";
$password="pejone";
$hostname="localhost";

$dbname="portfolio";

if (!($link=mysql_connect($hostname, $user, $password))) { echo "mysql_error() :: Error conecting to the data base<br>"; }
else {
mysql_select_db($dbname, $link) or die (mysql_error());
}
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby t_davisjr » Mon Mar 31, 2003 10:25 am

Ok...wow i can't believe that was so simple....I works ok...you guys "ROCK"

thanks
t_davisjr
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sun Mar 30, 2003 5:47 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

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

cron