If i simplify a code that collects a database value and stores it as a variable, will this still work? (I have already connected to the database)
$Record = mysql_fetch_row(mysql_query(';SELECT ScreenName FROM Register WHERE Username = $Username';));
$ScreenName = $Record[0];Will this PHP code work to get a sql database value and store it as a variable?
I believe the code will work. I usually divide it up a bit so I can change it quicker, and it is a bit easier to work it.
The way to know for sure: upload it to a server and test it out :DWill this PHP code work to get a sql database value and store it as a variable?
Should work, but might not in some mysql versions: syntax is not standard.
$sql = ';select `ScreenName` from `Register` where `Username`='';.$Username.';'';;
$Record = mysql_fetch_row($sql);
$ScreenName = $Record[0];
It will work but I recommend yout to put mysql_fetch_row and mysql_query in seperate rows.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment