Hello again everyone. I sorted out my problem with tables by re-jigging the code around a little bit. However, I still have one question for now. I want to be able to search my database using a php page. So, I want to search for something between two dates (fromDate) and (toDate). So far, I have the user enter in the details into a form on one page, when they click submit I want it to show their search results.
The response page as it stands, shows what data they entered. The query I have used it here:
[code=php]
$fromDate = $_POST['fromDate'];
$toDate = $_POST['toDate'];
$query = 'select c.Firstname, c.Lastname, v.Title from Customer as c inner join Loan as l on (c.customerId = l.customerId) inner join Video as v on (v.videoId = l.videoId) where l.date >=$fromDate and l.date <=$toDate';
$result = mysql_query($qu ery) or die('No loans Found: ' . mysql_error());
[/code]
The problem I'm haiving is with ...where l.date >=$fromDate and l.date <=$toDate'; I seem to have a problem with the where clause. I thought that using $fromDate would work, but it would appear not. Can anyone share some advice with me on this one?
Great thanks!
The response page as it stands, shows what data they entered. The query I have used it here:
[code=php]
$fromDate = $_POST['fromDate'];
$toDate = $_POST['toDate'];
$query = 'select c.Firstname, c.Lastname, v.Title from Customer as c inner join Loan as l on (c.customerId = l.customerId) inner join Video as v on (v.videoId = l.videoId) where l.date >=$fromDate and l.date <=$toDate';
$result = mysql_query($qu ery) or die('No loans Found: ' . mysql_error());
[/code]
The problem I'm haiving is with ...where l.date >=$fromDate and l.date <=$toDate'; I seem to have a problem with the where clause. I thought that using $fromDate would work, but it would appear not. Can anyone share some advice with me on this one?
Great thanks!
Comment