Forum Moderators: coopster
if (isset($_SESSION['user']) && !empty($_SESSION['user']) && ctype_alpha($_SESSION['user'])){
$query = "SELECT * FROM `quotestest` WHERE `username` = '".$_SESSION['user']."' ";
$result = mysql_query($query)or die (mysql_error());
if(mysql_num_rows($result) > 0){
while ($row = mysql_fetch_array($result)){
//try echoing the actual array to see if the keys/column names are as you have referred to them :)
echo "<pre>";
print_r($row);
echo "</pre>";
echo $row['quoteid']." ".$row['fromcompany']." ".$row['fromcontact'];
}
//query returned no rows
else{
echo "No rows returned";
}
}
else{
echo "User not in db";
exit;
}
Its probably something very simple so I shall brace myself for the embarrassment.
I tried the last script you kindly put up, unfortunately it errors out on the else statement else{
echo "No rows returned";
}
clients table:
clientid | username | password
55...... |steve | 123
57...... | sally | 321
quotestest table:
quoteid |username | fromcompany | fromcontact | toemail
8........ | empty | SDF | dsfd | t@te.com
19...... | empty | ZCX | dsfc | t@te.com