Forum Moderators: coopster

Message Too Old, No Replies

query not working.

         

hanyaz

12:38 pm on Apr 14, 2009 (gmt 0)

10+ Year Member



Hello,
I am trying to pull data from my table without any success, i got a blank page....here is the code :

<?php mysql_connect("localhost", "#*$!", "#*$!");

mysql_select_db("#*$!");

$reponse = mysql_query("SELECT * FROM jos_content WHERE 'title' LIKE '%GOLDMAN SACHS%' LIMIT 0, 30");
while ($donnees = mysql_fetch_array($reponse) )
{

?>

<?php echo $donnees['title']; ?><br />

<?php

}

mysql_close();
?>

PLease help
Thanks
hanyaz

eelixduppy

1:28 pm on Apr 14, 2009 (gmt 0)



Are you getting any errors from this script? Check your log. Also, are you sure that the query is returning results?

hanyaz

1:46 pm on Apr 14, 2009 (gmt 0)

10+ Year Member



hello,
i just took off the brackets from 'title' and it worked.
thanks

eelixduppy

4:12 pm on Apr 14, 2009 (gmt 0)



I think you meant to say single quotes, right? In any case, if you did want to escape it you have to use the prime character (`) not the single quote ('). So the query would then look like this:

SELECT * FROM jos_content WHERE `title` LIKE '%GOLDMAN SACHS%' LIMIT 0, 30

Anyway, glad you got it resolved.