Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- pass the variable from url


penders - 9:44 am on Nov 10, 2011 (gmt 0)


Actually you want $kv to replace 1ww, not \'1ww\' (since you still need the resulting single quotes in your SQL). To keep with your current single quotes, this becomes...

$sql = 'SELECT * FROM `words` WHERE `key` = \''.$kv.'\'';

Or, changing to double quotes is probably clearer...
$sql = "SELECT * FROM `words` WHERE `key` = '$kv'";

Also, I don't think you need to urldecode() your string initially, since PHP should do this automatically. But you might need to call mysql_real_escape_string() to sanitize it.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4385463.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com