By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

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

P: 30
This is my code

Expand|Select|Wrap|Line Numbers
  1. $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());
  2. $total_records = mysql_fetch_assoc($results);
  3. $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 '= 'isaspainstitute.com' AND menu_name = 'news' AND menu_type = 'news'' at line 1

What was the mistake in my script?
Nov 25 '14 #1

✓ answered by Luuk

It's in the manual.... ;)
http://dev.mysql.com/doc/refman/5.6/en/select.html

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

Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,035
It's in the manual.... ;)
http://dev.mysql.com/doc/refman/5.6/en/select.html

It says you need 'WHERE' in your SQL-statement.
Nov 25 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.