Jump to content

[SOLVED] searching query


phpSensei

Recommended Posts

I have two fields in my form, One is Genre (Menu/List) Of The Movie, and the other is the search field.

 

In my database, the list of movies have a genre row, showing which genre they belong two.

 

300 - Action

Simpsons Movie - Comedy...

 

The Menu/list field lets you choose the genre...

 

So is this query right?

 

<?php
$select=$_POST['genre'];

$data = mysql_query("SELECT * FROM list WHERE id_genre='$select' upper(title) LIKE'%$find%'"); 
?>

Link to comment
https://forums.phpfreaks.com/topic/65490-solved-searching-query/
Share on other sites

It needs to be either

 

$data = mysql_query("SELECT * FROM list WHERE (id_genre='$select') AND (upper(title) LIKE '%$find%') ");

 

or

 

$data = mysql_query("SELECT * FROM list WHERE (id_genre='$select') OR (upper(title) LIKE '%$find%') ");

 

which one you use depends on what you want to find

 

 

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.