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
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.

Link to comment
Share on other sites

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.