Syntax problem again..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jotae
Forum Commoner
Posts: 25
Joined: Fri Jul 02, 2010 5:49 pm

Syntax problem again..

Post 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..
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: Syntax problem again..

Post 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");
jotae
Forum Commoner
Posts: 25
Joined: Fri Jul 02, 2010 5:49 pm

Re: Syntax problem again..

Post by jotae »

Thx. Work local but not Remote... I review the Db in Remote and all are OK. Don´t know what happen...
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: Syntax problem again..

Post 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.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Syntax problem again..

Post 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());
jotae
Forum Commoner
Posts: 25
Joined: Fri Jul 02, 2010 5:49 pm

Re: Syntax problem again..

Post 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 :-)
Post Reply