Answer the question
In order to leave comments, you need to log in
How is a SQL query made with a dash in a variable?
Good afternoon! Strange problem! At me values in the table are stored with a dash. Let's say 00-0000001. When I make a query in the database directly, everything works! But when I try to apply from php, no! I copy the same request and nothing. It works without variables ... maybe there is some trick?
$user=addslashes($user);
$query1 = "SELECT * FROM `cat` WHERE `id` like '".$user."'";
$result1 = mysql_query($query1);
Answer the question
In order to leave comments, you need to log in
$one = 10;
$two = 111111;
$all = $one.'-'.$two;
"SELECT * FROM `cat` WHERE `id` like '".$all."'";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question