june_c21 Posted March 17, 2008 Share Posted March 17, 2008 i just made an event calendar where user can input their event and store in database. i am stuck with these select statement where i need to pull the data from the database and show it accoring to the date,month,year in the calendar. $query = "SELECT staff_no, eventdate,event FROM calendars "; $result1 = mysql_query($query, $dblink); while { } Quote Link to comment Share on other sites More sharing options...
bobinindia Posted March 17, 2008 Share Posted March 17, 2008 Loooks like you are using MySQL 5 so: mysqli_query is what you need: $query = "SELECT staff_no, eventdate,event FROM calendars "; $result1 = mysqli_query($query, $dblink); while { } Quote Link to comment Share on other sites More sharing options...
june_c21 Posted March 17, 2008 Author Share Posted March 17, 2008 ya, i am using mysql 5 $query = "SELECT staff_no, eventdate,event FROM calendars "; $result1 = mysqli_query($query, $dblink); while { } i don't know how to write the code in the while loop where it will output the event according to dd,mm,yyyy and link with the calendar i created. Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted March 17, 2008 Share Posted March 17, 2008 Try this: while ($row = mysqli_fetch_assoc($result1)) { ... } In that while loop you can use $row['staff_no'], $row['eventdate'], and $row['event'] to get those values from the current row in the database you're outputting. Quote Link to comment Share on other sites More sharing options...
bobinindia Posted March 17, 2008 Share Posted March 17, 2008 $query = "SELECT staff_no, eventdate,event FROM calendars ORDER BY eventdate "; Add either ASC or DESC after eventdate to get the reverse of what comes from your db. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.