Jump to content

Abaddon1979

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Abaddon1979's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Could I just use something like this? [code]while($dbstuff = mysql_fetch_array($result, $2nd_result)){[/code] I could also use "array_combine" but how do I set the arrays outside of a while loop?
  2. I want to combine two mysql searches and combine them, then search. Now here is my current sql query and while loop. [code]$query="SELECT * from calendar where starttime LIKE '$eventid%' ORDER BY starttime"; $result=mysql_query($query); while($dbstuff = mysql_fetch_array($result)){ echo " Blah Blah Blah table stuff ".$dbstuff['starttime'].""; }[/code] I know there is a way to sort the array. But how would add another sql statement and combine them into one array so I can sort them that way?
  3. I thought about this on my drive home and came to a simple solution. I can just add another database and search that instead. That way when i search for the date it will only show the single events and when I search for the day it will show the recurring, then it will only display once. If I do that is there I can use php to sort both while loop outputs instead of executing them one after another? And if I can where do i start?
  4. checkcal.php [code]<? $eventid = $_REQUEST['eventid']; $calday = date('l', strtotime($_REQUEST['eventid'])); $calmonth = date('F', strtotime($_REQUEST['eventid'])); $calyear = date('Y', strtotime($_REQUEST['eventid'])); $caldate = date('jS', strtotime($_REQUEST['eventid'])); $sql = "SELECT * from calendar where starttime LIKE '$eventid%' ORDER BY starttime"; $result = mysql_query($sql) or die ("Invalid query"); if (!mysql_num_rows($result)) { $sql = "SELECT * from calendar where repeat LIKE '$calday%' ORDER BY starttime"; $result = mysql_query($sql) or die ("Invalid query"); } if (!mysql_num_rows($result)) { echo "<body bgcolor=\"#222222\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" height=\"100%\" width=\"100%\"><tr><td valign=\"middle\" align=\"middle\"><font class=\"fontstyle\">I'm sorry, but there are no raids scheduled for $calday, $calmonth $caldate $calyear..</font></td></tr></table></body>"; } else { include 'raidcal.php'; } ?> [/code] Raidcal.php [code] <? $query="SELECT * from calendar where starttime LIKE '$eventid%' ORDER BY starttime"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $submiter=mysql_result($result,$i,"submiter"); $instance=mysql_result($result,$i,"instance"); $event_finish=mysql_result($result,$i,"event_finish"); $raiddisc=mysql_result($result,$i,"raiddisc"); $repeat=mysql_result($result,$i,"repeat"); $i++; echo "Table junk"; } $query="SELECT * from calendar where repeat LIKE '$calday%' ORDER BY starttime"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $id1=mysql_result($result,$i,"id"); $submiter1=mysql_result($result,$i,"submiter"); $instance1=mysql_result($result,$i,"instance"); $event_finish1=mysql_result($result,$i,"event_finish"); $raiddisc1=mysql_result($result,$i,"raiddisc"); $repeat1=mysql_result($result,$i,"repeat"); $i++; echo "Table junk"; } ?>[/code]
  5. [quote author=HuggieBear link=topic=107945.msg433827#msg433827 date=1158187206] Do you have an example of it anywhere that I can check it out? Rich [/quote] http://dev.steel-legion.com The first posts code in action. It works but it Inst that great. In the database there is three records. Two are for the 13th of September. One is for the 20th. Here is the problem. The record from the 20th has an enum of Wednesday(which shows its repeatable). Which is fine every Wednesday it does show up, you can go to October and click on any Wednesday and you will see there is a record. However if you click on the 20th you will see two records. This is because it is searching for the event date 2006-09-20 as well as the repeat enum of Wednesday and it is showing up twice.
  6. I have recently started working on a php event calender and I'm a bit stuck on a particular function I want the calendar to have. So here is the code I currently have. It searches the database and comes up with all the events for a particular day the $eventid is passed to the page from the address. [code]<? include 'db.php'; $query="SELECT * from calendar where starttime LIKE '$eventid%' ORDER BY starttime"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $submiter=mysql_result($result,$i,"submiter"); $instance=mysql_result($result,$i,"instance"); $event_finish=mysql_result($result,$i,"event_finish"); $raiddisc=mysql_result($result,$i,"raiddisc"); $repeat=mysql_result($result,$i,"repeat"); $i++; } ?> [/code] Now I'm still working on the repeatable events. The $repeat is a enum with the days of the week Saturday, Sunday, Monday ect. So what I was thinking is I could just add another mysql search and do the code much the same way it was done as above. [code]<? include 'db.php'; $query="SELECT * from calendar where repeat LIKE '$dayofweek%' ORDER BY starttime"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $submiter=mysql_result($result,$i,"submiter"); $instance=mysql_result($result,$i,"instance"); $event_finish=mysql_result($result,$i,"event_finish"); $raiddisc=mysql_result($result,$i,"raiddisc"); $repeat=mysql_result($result,$i,"repeat"); $i++; } ?> [/code] The problem is if I add a event for Wednesday september 13th (2006-09-13) and then check the event calendar for that day it will repeat the same output twice. Is there a way I can avoid this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.