I have query which is not working
$lokesh = "select * from license_info where mac_id='$mac_id' and admin_user_name='$admin'";
In above query I am selecting record where macid and admin_user_name where matched
But while I echo this sql query it show output like
select * from license_info where mac_id='0800279020F2' and admin_user_name='sanjay
'
last single quotes is printing in below line so I am not able to retrive record. What is the reason of printing single quotes in below line
The reason is that your variable $admin contains a newline in the end. Remove it and there will be no problem with this.
You will, however, have a possible SQL injection attack. Use parameters, not inline values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With