Jump to content

[SOLVED] Need help with, mysql_fetch_assoc()!!, anyone ?


jamesxg1

Recommended Posts

I have this code

 

 

<?php
$connect = mysql_connect("localhost","root","");
if (!$connect)
  {
  die('Could not connect: ' . mysql_error());
  }

// some code
$sql = "SELECT `id`,`username` FROM `users`";
$query = mysql_query($sql);
while ($row = mysql_fetch_assoc($query)) {
echo "<a href=\"profile.php?id={$row['id']}\">{$row['username']}</a><br>";
}

mysql_close($connect);
?>

 

 

But im getting this error.

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\memberlist.php on line 11

 

Any idea's on why ?, I really need this fixed ?

 

James.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.