PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i have submitted a data using post and i just want to add a percent sign into that variable, how can i add that to the query? thanks! below are my code..
$date1 = $_POSTї'date1'];
// i just want to add a percent sign at the end of the value of date 1
so that i can do this query...
select * from tbl where userName = '$select' and date like '$date1'
//which would appear something like this one:
select * from tbl where userName = 'name' and date like '03-05-05%'
//where name and 03-05-05 are submitted from a form
how would i do that adding the percent sign in the end?
$query = "e;select * from tbl where userName = '$select' and date like '{$date1}%'"e;;
$result = mysql_query($query);
$total_rows = mysql_num_rows($result);
if (!$total_rows) { .....
$result = mysql_query($query) or die(MySQL_Error());
adding the " or die ... " clause will present you with the actual error you have in your query... very good idea to use it whenever you are gonna query just about anything