then i stumbled upon a problem....
Code: Select all
$db_user = "username";
$db_pass = "database";
$db_host = "localhost";
$db_name = "my_database";
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_name);
$query = "SELCT * FROM users";
$result = mysql_query($query);
while ($record = mysql_fetch_row($result)) {
for ($i=0; $i<count($record); $i++) {
echo $record[$i]."<br>";
}
echo "<br>";
}
What happens when i upload the script and run it is that I get this error message:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home2/prexserv/public_html/learning_php/lesson6/06_03_database.php on line 14
I understand that something is wrong with the " while ($record = mysql_fetch_row($result)) " I just don't know why!
What i'm wondering here is if the script is wrong or if it is a connection probem... (i am currently using PHP/mySQL scripts on the server so the setup on the server itself is corect as far as i know)
-Chris