Jump to content

[SOLVED] does not return result on page, but does from db


Recommended Posts

Hello

 

Im only an occaisional user of php and mysql, so I forget stuff, but this is driving me insane

 

I have a form on an html page, i have a drop down which allows users to select a search term, the search term is sent to a php page; which takes the value and turns it into a variable, $valx  i want to use this value to search for the term in my db.

 

this is my query:

 

"SELECT Doc, Abstract, Topic, DATE_FORMAT(pubYear, '%Y') AS MyYear, Keywords FROM tblDoc WHERE Topic LIKE $valx ORDER BY MyYear DESC";

 

This is returning nothing what so ever. 

 

In order to test if the variable was working  did this

 

echo "selected text was $valx";

 

which works

 

I have tried substituting the variable for an actual value in the quey, for example "water" this returns all of the results, but I cannot get it to return the results when I use the value.

 

I am completely flummoxed by this and any help that can be offered would be really appreciated.

 

Thanks

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.