Jump to content

Recommended Posts

How can i get the following search results to happen on one form .

what happens is that when i set the last search query it is the only query that will work correctly.

i was useing this to get the data out, i no that the varable $result is used 3 times but if i cahnge them to example $result1 and $result2 and $result3 how do i set the mysql_fetch assoc.

only an example ok.
[code]

while($row=mysql_fetch_assoc( ($result1) || ($result2) || ($result3) )){

[/code]

[code]

$db=mysql_connect("localhost","xxxx","xxxx");
mysql_select_db("promotor" , $db);


$query="select * from member_info where name like '%".$name."%'";
$result=mysql_query($query);



if(mysql_num_rows($result)==0) {
echo"no result";
exit;
}else{

$query="select * from member_info where band_name like '%".$band_name."%'";
$result=mysql_query($query);




if(mysql_num_rows($result)==0) {
echo"no result";
exit;
}else{


$query="select * from member_info where music_played like '%".$music_played."%'";
$result=mysql_query($query);



if(mysql_num_rows($result)==0) {
echo"no result";
exit;
}
}
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/11237-search-problam-help-cheers/
Share on other sites



[code]$query="select * from member_info where music_played like '%".$music_played."%'and band_name like '%".$band_name."%'
and name like '%".$name."%'";
$result=mysql_query($query);



if(mysql_num_rows($result)==0) {
echo"no result";
exit;
}
[/code]


[!--sizeo:7--][span style=\"font-size:36pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--]
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.