Jump to content

Basic but giving me problems


debuitls

Recommended Posts

Hi all,

 

Im trying to select all the email address where the county is equal to the county variable and the starrating is is bigger or equal to the $starrating variable.

 

$sql = "SELECT signuphotel.email
FROM proposal
LEFT JOIN signuphotel ON proposal.county = signuphotel.county
AND proposal.starrating = signuphotel.starrating
WHERE proposal.county = '$county'
AND proposal.starrating >= '$starrating'
AND proposal.time = NOW()
";

 

This statement returns correctly in phpmyadmin.

 

However when I run it in my php script I get an error saying "No recipient addresses found in header" if starrating variable is set to starrating of 4 and the there is only hotels with 5 starrating in the table.

 

It might be straightforward question but can anyone see where im going wrong??

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/175064-basic-but-giving-me-problems/
Share on other sites

Thanks for getting back to me Crayon Violent.

 

Yes the variables hold the correct values.

 

The problem is with the 'greater than' part.

 

If the variable holds a four starrating it wont and there is only a five starhotel it wont find the larger starrating.

 

If the variable holds a five starratting and the there is a five starrhotel then it works fine.

 

Can anyone help

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.