silas101 Posted July 17, 2009 Share Posted July 17, 2009 Hi there. i have 2 forms. form 1 inputs a string exactly 2009-01-05 second form has DateFrom field as $dfrom = $_POST['datefrom']; (which is correct to use)? $dto = $dateto; (which is correct to use)? i have sql query as $result = mysql_query("SELECT branch_name,Date FROM 'Payments' WHERE Date = {$dfrom} ORDER BY Branch,Date desc"); if i take out the where.. query gets results if i use date value in where...eg '2009-07-17' it returns results i am thinking the $dfrom parameter is getting no value and that is why i get no error and just empty results. how do i get the value of the datefield on the previous form into my query? Thank you sooooooo much Link to comment https://forums.phpfreaks.com/topic/166318-solved-mysql-where-datefield-dataparam-in-php/ Share on other sites More sharing options...
rhodesa Posted July 17, 2009 Share Posted July 17, 2009 You need quotes around it: $result = mysql_query("SELECT branch_name,Date FROM 'Payments' WHERE Date = '{$dfrom}' ORDER BY Branch,Date desc"); Link to comment https://forums.phpfreaks.com/topic/166318-solved-mysql-where-datefield-dataparam-in-php/#findComment-877069 Share on other sites More sharing options...
silas101 Posted July 20, 2009 Author Share Posted July 20, 2009 Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuu you are the savior of this man. if ever you are in Africa, South Africa, remember to find me and i will organize a free car wash for your rented vehicle.... Thank you Link to comment https://forums.phpfreaks.com/topic/166318-solved-mysql-where-datefield-dataparam-in-php/#findComment-878445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.