Code: Select all
SELECT * from `profile` WHERE userid='$_SESSION[userid]'Code: Select all
SELECT * from `profile` WHERE userid='".$_SESSION[userid]."'Please clearify me...
Moderator: General Moderators
Code: Select all
SELECT * from `profile` WHERE userid='$_SESSION[userid]'Code: Select all
SELECT * from `profile` WHERE userid='".$_SESSION[userid]."'Code: Select all
<?php
session_start();
// here we will keep all the data that is ready to be used in a mysql query
// typically we need to perform mysql_real_escape_string on it
$mysql = array();
// if we were generating html we could have a $html array too
// and we typically perform htmlentities( $value, 'utf-8') on it
// test if the data is available
if (isset($_SESSION['userid'])) {
// prepare the userid to be used in a mysql query
mysql['userid'] = mysql_real_escape_string($_SESSION['userid']);
} else {
// housting we got a problem, trigger_error?
}
// select only the columns that we need
$query = "SELECT column1, column2 FROM profile WHERE userid='{$mysql['userid']}'";
?>