Connecting Tech Pros Worldwide Help | Site Map

list() query not working

  #1  
Old June 16th, 2009, 06:16 AM
Newbie
 
Join Date: May 2009
Posts: 21
Hello,

When I run the code below when $entry = miami.com, I get the following error message:

Quote:
SELECT COUNT(*) FROM #&*+ WHERE `site` LIKE 'miami.com':You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
It looks like I'm not correctly defining $table. Any ideas how I could do that?

Thanks in advance,

John


Expand|Select|Wrap|Line Numbers
  1. $result = mysql_query("SHOW TABLES FROM feather") 
  2. or die(mysql_error()); 
  3.  
  4.  
  5. while(list($table)= mysql_fetch_row($result))
  6. {
  7.   $sqlA = "SELECT COUNT(*) FROM $table WHERE `site` LIKE '$entry'";
  8.   $resA = mysql_query($sqlA) or die("$sqlA:".mysql_error());
  9.   list($isThere) = mysql_fetch_row($resA);
  10.   if ($isThere)
  11.   {
  12.      $table_list[] = $table;
  13.   }
  14. }
  #2  
Old June 16th, 2009, 04:07 PM
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
Provided Answers: 2

re: list() query not working


I think '%' is missing.
http://dev.mysql.com/doc/refman/5.0/...-matching.html
  #3  
Old June 16th, 2009, 10:50 PM
prabirchoudhury's Avatar
Familiar Sight
 
Join Date: May 2009
Location: Wellington, New Zealand
Posts: 152

re: list() query not working


hey.

If no wildcard characters (%%, …, _) are used then there should be no difference in
performance between
Expand|Select|Wrap|Line Numbers
  1. “… WHERE site='$entry' ” and “..WHERE site LIKE '$entry'”
the two queries . so , I think you need to check with your query and passing variable matches.


:)
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced filter... Load from Query not working...Help! * Repost * Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ answers 0 August 9th, 2007 03:15 PM
Advanced filter... Load from Query not working...Help! Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ answers 0 August 7th, 2007 07:15 PM
Query open, If Or And condition not working ljungers answers 3 December 31st, 2006 10:59 PM
Why is this query not working? Susan Ator answers 0 July 19th, 2005 11:47 PM