mysql - mysql_query() not taking php variables -


I am passing a variable in a mysql query, $ name is a variable that is receiving a decrypted string. It has been passed from the search query later in the name of the name $ (which I have seen through an echo).

The search query does not take this variable only if I get a quotation of the string that exists in the SQL table, I get an output (counts as 1). I can not see where the problem is, because the same code is working in another file (its query in its query with an HTML entry), and its embarrassing!

  $ decrypted_text1 = mcrypt_ecb (MCRYPT_DES, $ key_view, $ encrypted_text1, MCREEDPDRWPT); $ Name = $ decrypted_text1; $ Username = "root"; $ Password = "speaker 1"; Hostname = "localhost"; $ Dbhandle = mysql_connect ($ hostname, $ user name, $ password) or die ("Can not connect to database"); $ Selected = mysql_selectdb ("Login", $ dbhandle); $ Query = "Select * From Users Where Username = '$ name'"; $ Result = mysql_query ($ query, $ dbhandle) or die (mysql_error ()); $ Count5 = mysql_num_rows ($ result); Delete  quotation mark    

around the variable to look like this Should:

  $ query = "Select from user where user name = $ name";  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -