Warning: mysql_fetch_array() problems
Posted: Wed Oct 29, 2008 2:29 am
Hi, I have this problem with retrieving data from my database, any help would greatly appreciated.
here is a snippet of code, the error is in the mysql_fetch_array() function. I can connect to my databse fine, but cant retrieve data.
I have looked all over the net for answers, and it seems most of the time this error is caused by a query that dosn't work. However, I have copy and pasted the exact query into my database and it works fine, but when I try it with the mysql_fetch_array($querry) it says... Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xanatosm/public_html/dataBaseInfo.php on line 37.
please help, Im going crazzy.
here is a snippet of code, the error is in the mysql_fetch_array() function. I can connect to my databse fine, but cant retrieve data.
Code: Select all
<?php
//connecting to mySQL database
$dbhost = 'localhost';
$dbuser = 'XXXX';
$dbpass = 'XXXX';
$dbname = 'XXXX';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
//
//get form variables and use them for querry
$query = "SELECT * FROM XUSERS";
$result = mysql_query($query);
//
while ($row = mysql_fetch_array($result))
{
echo $row['id'];
}
?>please help, Im going crazzy.