Jump to content

help with where clause


DataSpy

Recommended Posts

I'm using a drop down menu to get a value to search a mysql db.  The problem comes in when they want to search for everything for example in categories, it would be: all categories, comedy, horror, ect...  How do I use a WHERE clause to search for everything, I tried * but that doesn't work.

 

Example of my WHERE clause:

FROM movies ORDER BY movie_main_title WHERE $row[movie_catagory] = $_POST[movie_catagory]";

 

Any help would be greatly appreciated,

thanks in advance!!!

Link to comment
https://forums.phpfreaks.com/topic/239151-help-with-where-clause/
Share on other sites

Thanks, I figured it out  :D  I used LIKE and then made the passed variable for all categories %%

 

The query looks like this

$query_search_movies = "SELECT 
	movies.movie_main_title, 
	movies.movie_foreign_title,
	movies.movie_year,
	movies.movie_catagory,
	movies.movie_language,
	movies.movie_country,
	movies.movie_discs,
	movies.movie_format,
	movies.movie_extention,
	movies.movie_link,
	notes.notes_id,
	notes.notes_notes
	FROM movies 
	LEFT JOIN notes
	ON movies.movie_notes_id = notes.notes_id 
	WHERE movies.movie_catagory LIKE '$_POST[movie_catagory]'
	ORDER BY movies.movie_main_title";
$result_search_movies = mysqli_query($con, $query_search_movies) or die(mysqli_error($con));

 

Thanks for the help!!!  :D

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.