Problem with mysql_fetch_assoc
Posted: Fri Jul 02, 2010 6:04 pm
Please help me:
This code have problems:
$tipomus is a string variable.
The error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\SML\to.php on line 117 and don't read the records. Is possible a sintax error?
Whith this simple line, work ok: $result=mysql_query("select * from temas order by tema");
Thx for your help. Is urgent for me.
This code have problems:
Code: Select all
$con = mysql_connect("localhost", "root", "")or die('MySQL Connect Error: '.mysql_error("No hay conexión a la Base de Datos"));
mysql_select_db("midis",$con);
$result = 'select * from temas where CLASE like \'%'.$tipomus.'%\' order by ' . $sort;
while($row=mysql_fetch_assoc($result)){
//while ($row=mysql_fetch_array($result)){
echo '<tr><td>'.$row["clase"].'</td>';
echo '<td>'.$row["tema"].'</td>';
echo '<td>'.$row["ritmo"].'</td>';
echo '<td>'.$row["autor"].'</td>';
echo '<td>'.$row["arreglo"].'</td>';
echo '<td>'.substr($row["fecha"],-12,4).'</td>';
if ($row["nuevo"]=='Y'){
echo '<td>'."Nuevo".'</td></tr>';
}else{
echo '<td>'."".'</td></tr>';
}
}The error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\SML\to.php on line 117 and don't read the records. Is possible a sintax error?
Whith this simple line, work ok: $result=mysql_query("select * from temas order by tema");
Thx for your help. Is urgent for me.