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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.