You have an error in your SQL syntax check the manual that corresponds to your MySQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bala Kumaran
    New Member
    • Jan 2013
    • 30

    You have an error in your SQL syntax check the manual that corresponds to your MySQL

    This is my code

    Code:
    $results = mysql_query("SELECT COUNT(*) as 't_records' FROM `news` domain = '".$domain."' AND menu_name = '".$menu_name."' AND menu_type = '".$menu_type."'") or die(mysql_error());
    $total_records = mysql_fetch_assoc($results);
    $total_groups = ceil($total_records['t_records']/$items_per_group);
    I am getting error from this above code.

    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 '= 'isaspainstitut e.com' AND menu_name = 'news' AND menu_type = 'news'' at line 1

    What was the mistake in my script?
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    It's in the manual.... ;)


    It says you need 'WHERE' in your SQL-statement.

    Comment

    Working...