Copy link to clipboard
Copied
Hello All,
Here's what I want to do:
Take this - $sql = 'SELECT name FROM galleries WHERE spec = XYZ'
where XYZ is a variable passed down from a query string.
What is the proper syntax/procedure for placing a variable in the above statement? I'm trying everything I can think of to no avail.
ADDED:
Maybe more info will be helpful. I only want to pick records out of the 'galleries' table whose 'spec' record is equal to the value of the query string selected on the previous page. Does that make sense? I feel I'm going nuts in the head and may not be explaining myself the best.
Thanks in advance for any help you can offer!
Sincerely,
wordman
Copy link to clipboard
Copied
Quit looking, I found it.
This is the part that I was missing. I found it on a php developer forum and just tested it...works perfect!
$sql = "SELECT g_name, g_desc FROM galleries WHERE g_spec = '$spec%' " ;
What I didn't know was that I had to surround the variable in quotes and add the % at the end. Now, I can pull the data from my DB however I like and it works.
I wanted to post this here in case anyone else had a similar hitch.
Many thanks to everyone here for your help! ![]()
Cheers,
wordman
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more