mysql_fetch_object(): supplied argument is not a valid MySQL
Posted: Mon Aug 10, 2009 8:25 am
Hi there!
I'm new in PHP
I'm trying to connect php and adobe flex(mxml)
why does it have an error that says: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\wamp\www\irmnewest-debug\studinfo.php on line 11
I just want to display those data who have a username of variable $varUser in my datagrid in adobe flex.
I'm new in PHP
I'm trying to connect php and adobe flex(mxml)
why does it have an error that says: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\wamp\www\irmnewest-debug\studinfo.php on line 11
I just want to display those data who have a username of variable $varUser in my datagrid in adobe flex.
Code: Select all
<?php
include("connection.php");
$varUser= mysql_real_escape_string($_POST["untext"]);
$query = "SELECT username, studentid, firstname, lastname, course, year FROM student where username = $varUser";
$result = mysql_query($query);
print "<datas>";
while ($recordset = mysql_fetch_object($result) ){
print "<data><username>".$recordset->username."</username>
<id>".$recordset->studentid."</id>
<ln>".$recordset->lastname."</ln>
<fn>".$recordset->firstname."</fn>
<kurs>".$recordset->course."</kurs>
<yr>".$recordset->year."</yr>
</data>";
}
print "</datas>";
?>