ghosttr Posted September 20, 2007 Share Posted September 20, 2007 I am having problems using variables in my my sql queries, and i dont know what im doing wrong. This works //Database Connection $query = "UPDATE INTO TABLE <table> WHERE id='102441019' SET color ='FFFF00'"; But the same thing using a variable does not ??? ??? //Database Connection $1="FFFF00"; $query = "UPDATE INTO TABLE <table> WHERE id='102441019' SET color ='$1'"; Quote Link to comment https://forums.phpfreaks.com/topic/70075-having-problems-using-variables-in-my-queries/ Share on other sites More sharing options...
hvle Posted September 21, 2007 Share Posted September 21, 2007 $1 is a number one or an L? You can't name a variable begin with a number Quote Link to comment https://forums.phpfreaks.com/topic/70075-having-problems-using-variables-in-my-queries/#findComment-351936 Share on other sites More sharing options...
hvle Posted September 21, 2007 Share Posted September 21, 2007 Also read the manual on SQL language, "update TableName set .... where (condition)" Quote Link to comment https://forums.phpfreaks.com/topic/70075-having-problems-using-variables-in-my-queries/#findComment-351939 Share on other sites More sharing options...
ghosttr Posted September 21, 2007 Author Share Posted September 21, 2007 ok i got that working But that just lead to other problems :'( I have a list of names that i get from the database in the first column In the second column i have text displayed as a color, also from the db. The form lets you select a different color and change it, and it refers to the name. Is there a way to specify the name in the form? Quote Link to comment https://forums.phpfreaks.com/topic/70075-having-problems-using-variables-in-my-queries/#findComment-351967 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.