Codes here !

Moderators: macek, egami, gesf

t_davisjr
New php-forum User
Posts: 2
Joined: Sun Mar 30, 2003 5:47 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??

Oleg Butuzov
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am
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());}`

t_davisjr
New php-forum User
Posts: 2
Joined: Sun Mar 30, 2003 5:47 pm
Ok...wow i can't believe that was so simple....I works ok...you guys "ROCK"

thanks