frequently ask ? : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 14 people (64%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

passing varibles doesnt work i.e.web.php?t=3 (select *from tbl where t=$t) it isnt getting it

Jan 6th, 2004 08:36
Bill Sanders, Sorin Neacsu, Eaymon Latif,


You are probably having the query inside single quotes ('). These do 
not allow passing of $ variables. You have two options :
1. Use double quotes : $sql = "SELECT * FROM `tbl` WHERE t=$t";
2. Use single quotes : $sql = 'SELECT * FROM `tbl` WHERE t='.$t.'';
Consider also register globals may be turned off.  If so, your query 
must read:
   select * from tbl where t=$_REQUEST['t']