look!
Posted: Sat Jul 04, 2009 4:05 pm
***** Please use a descriptive title for your posts *****
how do i had a variable to a mysql query? tried many times and nothing! there is a value in the var but it does not work?
***** Please use the
how do i had a variable to a mysql query? tried many times and nothing! there is a value in the var but it does not work?
***** Please use the
Code: Select all
tag when posting PHP *****[/color]Code: Select all
$userid = $_GET[id];
if (!$link = mysql_connect('localhost', 'u', 'p')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('modelsite', $link)) {
echo 'Could not select database';
exit;
}
$sql = 'SELECT username FROM members WHERE id = [b]$userid'[/b];
$result = mysql_query($sql, $link);