Jump to content

Select statement with && to combine results?


stevew

Recommended Posts

I have simplified my radio button request below:

 

<form name="myform" action="apple.php">

<input type="radio" name="apple" value="apple"> apple<br>

<input type="submit" value="submit" name="submit">

</form>

 

<form name="myform" action="banana.php" method="POST">

<input type="radio" name="banana" value="banana"> banana<br>

<input type="submit" value="submit" name="submit">

</form>

 

output for apple.php

$result = mysql_query("SELECT * FROM tbl WHERE apple LIKE 'yes%' ")

 

output for banana.php

$result = mysql_query("SELECT * FROM tbl WHERE banana LIKE 'yes%' ")

 

How can I create an apple-banana.php ?

$result = mysql_query("SELECT * FROM tbl WHERE apple && banana LIKE 'yes%' ")

 

thanks.

Link to comment
Share on other sites

this should help you

$result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' ");

 

That has the same comparison twice. Why?

 

I think thats what he wants, he wan t to into the table an d look for apples and bananas that have a value of yes. :shy:

Link to comment
Share on other sites

this should help you

$result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' ");

 

 

That has the same comparison twice. Why?

 

I think thats what he wants, he wan t to into the table an d look for apples and bananas that have a value of yes. :shy:

 

You should probably read your query string again. It has the same comparison twice, and the syntax is wrong. LIKE doesn't use an equality comparison '='.

Link to comment
Share on other sites

this should help you

$result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' ");

 

 

That has the same comparison twice. Why?

 

I think thats what he wants, he wan t to into the table an d look for apples and bananas that have a value of yes. :shy:

 

You should probably read your query string again. It has the same comparison twice, and the syntax is wrong. LIKE doesn't use an equality comparison '='.

 

hahahah pikachu sorry men  ment

$result = mysql_query("SELECT * FROM tbl WHERE apple LIKE ='yes%' AND banana LIKE = 'yes%' ");

Link to comment
Share on other sites

Guest
This topic is now 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.