Warning: mysql_fetch_assoc(): supplied argument is not a val

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Warning: mysql_fetch_assoc(): supplied argument is not a val

Postby knoxville » 14. July 2005 12:45

Hi

I have some problems with mysql in xampp
here's the full error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\php\memberinfo.php on line 16

here's line 16: while ($record = mysql_Fetch_assoc($resultaat)){

i always get such errors with mysql also when i use mysql_fetch_object instead of mysql_Fetch_assoc and mysql_fetch_row().

can anyone help me? probably i have the wrong settings?
knoxville
 
Posts: 2
Joined: 14. July 2005 12:35

Postby Wiedmann » 14. July 2005 12:52

All you need is there...

supplied argument is not a valid MySQL result resource

So, "$resultaat" is not a resource, maybe the value of this variable is just "FALSE".
The error must be in (or before) the line, where you set this value.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby knoxville » 14. July 2005 14:59

hmm weard, maybe you can check: http://217.170.17.98/php/memberinfo.php, you see the error a couple of times.
and if you check http://217.170.17.98/php/memberinfo.php?id=1 then you see nothing so it didn't get info from the database

here's what i did in one of those cells:
<?php
include ("verbinding.php");
mysql_connect ("$dbhost","$username","$dbww");
mysql_select_db ("$db") or die ("Fout opgetreden");
$query = "SELECT * FROM users WHERE ID = $_GET[id]";
$resultaat = mysql_query ($query);
while ($record = mysql_Fetch_assoc($resultaat)){
echo "$record->uid<br>";
}
?>

i really can't find the prob prolly coz im pretty new to this
knoxville
 
Posts: 2
Joined: 14. July 2005 12:35

Postby Wiedmann » 14. July 2005 15:14

$query = "SELECT * FROM users WHERE ID = $_GET[id]";

This print out the correct query?
Code: Select all
echo  "SELECT * FROM users WHERE ID = $_GET[id]";


$resultaat = mysql_query ($query);

No error handling for mysql_query ()?

echo "$record->uid<br>";

$record is no object.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby alucard01 » 15. July 2005 05:04

- what about using "mysql_fetch_assoc" (small letter f).
- Your code seems to be incorrect.

You codes should be like this:

<?php
include ("verbinding.php");
mysql_connect ("$dbhost","$username","$dbww");
mysql_select_db ("$db") or die ("Fout opgetreden");
$query = "SELECT * FROM users WHERE ID = $_GET[id]";
$resultaat = mysql_query ($query);
while ($record = mysql_fetch_assoc($resultaat)){
echo $record["uid"]."<br/>"; //CORRECTION HERE ONLY
}
?>
alucard01
 
Posts: 122
Joined: 15. May 2005 13:51


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 185 guests