Page 1 of 1

Syntax problem again..

Posted: Tue Jul 13, 2010 4:01 am
by jotae
Problem with this line:

Code: Select all

 $result = mysql_query("SELECT TEMA, ARREGLO, AUTOR, RITMO, ARCHIVO, FECHA, NUEVO, CLASE from TEMAS where CLASE like \'%'.$tipomus.'%\' order by TEMA"); }

        while($row=mysql_fetch_assoc($result)){
//.....continue the code......
$tipomus is string.
The error in Remote Server:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/prolatin/public_html/sml/to.php on line 124

In Local Wamp Server work OK.
This line work Local and Remote:

Code: Select all

$result = mysql_query("SELECT CLASE, TEMA, RITMO, AUTOR, ARREGLO,FECHA, NUEVO FROM temas ORDER BY tema");
So, the problem in Remote is ...

Code: Select all

like \'%'.$tipomus.'%\'
but don´t know why.. Thx..

Re: Syntax problem again..

Posted: Tue Jul 13, 2010 4:06 am
by pbs
Try query like this

Code: Select all

$result = mysql_query("SELECT TEMA, ARREGLO, AUTOR, RITMO, ARCHIVO, FECHA, NUEVO, CLASE from TEMAS where CLASE like '%".$tipomus."%' order by TEMA");

Re: Syntax problem again..

Posted: Tue Jul 13, 2010 4:27 am
by jotae
Thx. Work local but not Remote... I review the Db in Remote and all are OK. Don´t know what happen...

Re: Syntax problem again..

Posted: Tue Jul 13, 2010 4:34 am
by pbs
There may be some field name, or some missing field name in the table. Also check table name, there may be case sensitivity problem.

Re: Syntax problem again..

Posted: Tue Jul 13, 2010 8:55 am
by Jade
You can use mysql_error to get more information about the problem you're having:

Code: Select all

$result = mysql_query("SELECT TEMA, ARREGLO, AUTOR, RITMO, ARCHIVO, FECHA, NUEVO, CLASE from TEMAS where CLASE like '%".$tipomus."%' order by TEMA") or die (mysql_error());

Re: Syntax problem again..

Posted: Tue Jul 13, 2010 10:55 am
by jotae
Wow. The table name is temas in remote and I send TEMAS. Solved. Thanks very much.... I don't get used to that PHP differs between Upper or Lower Case :-)