Jump to content

Please Help - SQL Syntax Error


pinacoladaxb

Recommended Posts

I'm having some trouble with a query I'm trying to make. I can't figure out what's wrong here. Can anyone see the issue?

 

sqltest.php source:

<?php

$q = 'test';

$con = mysql_connect('localhost', 'pauliuko', 'password') or die(mysql_error());

mysql_select_db('pauliuko_atomicriot', $con) or die(mysql_error());

$query = mysql_query("SELECT COUNT(*) FROM 'ac_users' WHERE 'username' = '$q'") or die(mysql_error());

list($number)=mysql_fetch_row($query);

echo $number;

mysql_close($con);

?>

 

sqltest.php displays:

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 ''ac_users' WHERE 'username' = 'test'' at line 1

 

I double checked my database and there is a table named 'ac_users' with a column named 'username'.

Link to comment
https://forums.phpfreaks.com/topic/181060-please-help-sql-syntax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.