Jump to content

[SOLVED] help a noob please


pazza86

Recommended Posts

hi everyone.

 

I'm a bit of a self taught noob who is learning the ropes, but im having some problems with a script that im writing.  What I am trying to do is enter a search term in a field (movie name) on one page and compare the field against data in the database (whether it be spelt right or not) and the next page display the corresponding data on one page.  I believe that i have the page that displays the information correct I just need some help with the query.  Please see the below mentioned script exerts and give a noob a hand :):

 

$result = mysql_query("SELECT * FROM movie WHERE mname = '%$mnsearch%'");

 

The above line when the submit button is clicked displays the table header information with no data in any cell.

 

$result = mysql_query("SELECT * FROM movie WHERE mname LIKE '%$mnsearch%'");

 

This line displays the table fine, the only problem being that it selects all of the data in the table, even when the movie name is spelt correctly.

 

Any help would be great.

cheers

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/84084-solved-help-a-noob-please/
Share on other sites

rows on content - it displays correctly, it is just displaying the incorrect data ???

First you type the search item in the text box then press search button and it is posted to another location rite?

Try to find first whether $mnsearch is empty or not

 

Do like this where you post the form

echo "<script>

alert('".$mnsearch."');

</script>";

i m sure you get empty message box.

Your problem occurred because $mnsearch is an empty string.

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.