Jump to content

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


mrsrowe

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

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.