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 { } Link to comment https://forums.phpfreaks.com/topic/96480-how-to-write-this-select-statement/ 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 { } Link to comment https://forums.phpfreaks.com/topic/96480-how-to-write-this-select-statement/#findComment-493759 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. Link to comment https://forums.phpfreaks.com/topic/96480-how-to-write-this-select-statement/#findComment-493766 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. Link to comment https://forums.phpfreaks.com/topic/96480-how-to-write-this-select-statement/#findComment-493768 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. Link to comment https://forums.phpfreaks.com/topic/96480-how-to-write-this-select-statement/#findComment-493799 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.