Page 1 of 1
Having Trouble With Variable in SQL String
Posted: Tue Mar 13, 2007 5:22 pm
by snowrhythm
i'm having a bit of trouble with this string here:
Code: Select all
$sql = 'SELECT * FROM industry WHERE industry_name LIKE "'.$link.'%"';
i'm pretty sure it has to do with that butchered-up LIKE statement...does anyone know the right syntax for that?
thanks in advance.
Posted: Tue Mar 13, 2007 5:27 pm
by RobertGonzalez
Its a SQL quote issue
Code: Select all
<?php
$sql = "SELECT * FROM industry WHERE industry_name LIKE '%$link%'";
?>
Posted: Tue Mar 13, 2007 5:35 pm
by snowrhythm
aha, thanks everah. i wish i would've posted that 45 minutes ago...could've saved me alot of trouble.
Posted: Tue Mar 13, 2007 5:37 pm
by RobertGonzalez
That's part of the learning curve my friend. In a few months, you will probably ask that question in 10 minutes (or better yet, find the answer here already [or even better yet, answer your own question as you ask it]).
Glad you got it worked out.