-1
$act = "1";
$query = mysqli_query($conn, "SELECT * FROM pp_ta WHERE Lic = '".$lic."' And WHERE active= '".$act."'");

Error 0You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE active= '1'' at line 1

Im thinking it has to do with quotes. Ive been tryng for 7 hours to figure it out..Any ideas?

kryle
  • 1
  • 7 hours on 1 string? You have an error in your SQL syntax, nothing to do with quotes. – Xorifelse Nov 19 '16 at 06:53
  • `SELECT * FROM table WHERE cola = 'value' and colb = 'value'` Where did you get the idea to add in a `WHERE` clause in the middle of an `AND` statement. – Xorifelse Nov 19 '16 at 06:55
  • That did it!!!!!!! I went through a BUNCH of different version of this statement..at one time I removed the second where..thank u xor!! – kryle Nov 19 '16 at 07:00

1 Answers1

1

you don't have to use where two times in one query. try this

$act = "1";
$query = mysqli_query($conn, "SELECT * FROM pp_ta WHERE Lic = '".$lic."' And active= '".$act."'");
Mudassar Saiyed
  • 1,146
  • 10
  • 20