hello friends,

I am try to get database values from while loop. but It gives me

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/empower.md/www/index_ujbee_file_uploard.php on line 32

here this is my code...

require "connect_ujbee_file_uploard.php";
require "todo.class_ujbee_file_uploard.php";
// Select all the todos, ordered by position:
$query = mysql_query("SELECT * FROM `ujbeeFile` ORDER BY `position` ASC");
$todos = array();
// Filling the $todos array with new ToDo objects:
while($row = mysql_fetch_assoc($query)){
	$todos[] = new ToDo($row);

but this is perfectly working at my local machine.I am using XAMPP version 2.5.8 but I put this script in to real server it give that error massage.

anybody can help me...? please....

Thank you
Umanda Jayo bandara

7 Years
Discussion Span
Last Post by rajarajan07

Change line 4 into:

$query = mysql_query("SELECT * FROM `ujbeeFile` ORDER BY `position` ASC") or die(mysql_error());

You will see that you do not have rights to login, the database does not exist, the table does not exist, or there is an error in your query.


try this.

$database = '';
$conn = mysql_pconnect(...conn info...);
mysql_select_db($database, $conn);
$query = "SELECT * FROM `ujbeeFile` ORDER BY `position` ASC";
$sql = mysql_query($query, $conn) or die(mysql_error());
while($row = mysql_fetch_assoc($sql)){
// the stuff

hope this helps :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.