Forum Moderators: coopster
basically what i want to do is depending on which username is logged in i want to show all rows in which the username appears, so from the above if the user jay is logged in it should show the day / month / year as
day ¦ month ¦ year
12 may 2005
13 may 2005
and not show the row in which kim appears.
Can somebody please help me! i really have hit a wall and would truly appricieate a hand thank you.
Note this is a generalization not specific code
Select * where username like jay
if (!$qid = mysql_query("SELECT day,month,year FROM booktable WHERE username = 'jay'",$cid)) {
die('Invalid query.');
}
while ($row = mysql_fetch_assoc($qid)) {
echo $row['month'].'/'.$row['day'].'/'.$row['year']."\n<br />",
}
Something like that ... ;p
<?php
$conn = mysql_connect("dbhost", "dbuser", "dbpass") or die(mysql_error());
mysql_select_db("dbname", $conn) or die(mysql_error());$name = "jay";
$query = "SELECT day, month, year FROM booktable WHERE username = '$name'";
$ask = mysql_query($query, $con) or die(mysql_error());while ($row = mysql_fetch_assoc($ask)) //or $row = mysql_fetch_array($ask)
{
echo $row['month'].'/'.$row['day'].'/'.$row['year']."\n<br />",
}
?>
Best luck!
Michal Cibor
PS. Why don't you use the mysql date format? CREATE TABLE test (to_day DATE); date is in this format YYYY-mm-dd eg 2005-05-01 in php to create such today just $to_day = date("Y-m-d");