Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. got it!!!! date_default_timezone_set('America/Los_Angeles'); $start = new DateTime('2013-01-31'); $end = new DateTime('2013-06-01'); $inc = DateInterval::createFromDateString('first day of next month'); $end->modify('+1 day'); $p = new DatePeriod($start,$inc,$end); foreach ($p as $d) echo $d->format('M') . '<br>';
  2. ok, I finally got some error messages, this is what I received: Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PST/-8.0/no DST' instead in Unknown on line 0 Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PST/-8.0/no DST' instead' in /ssl/index.php:13 Stack trace: #0 /ssl/index.php(13): DateTime->__construct('2013-01-31') #1 {main} thrown in /ssl/index.php on line 13
  3. yes, I am getting a blank white page. I prefer not do do the remotedesktop...I am just sort of paranoid that way if you know what I mean
  4. there may be an easier way to do this than what I am trying to do by combining a bunch of codes into one
  5. I thought I would be able to figure this stuff out, but here is what my ultimate goal is. I am building a member registration system and I found this code from someone else on here that does exactly what I had been looking for for a pagination of months. $offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0; $currMonth = date('n'); $list = array(); $list[] = mktime(0, 0, 0, $currMonth+$offset, 1); $list[] = mktime(0, 0, 0, $currMonth+$offset+1, 1); $list[] = mktime(0, 0, 0, $currMonth+$offset+2, 1); foreach ($list as $dateTS) { echo date('M Y', $dateTS) . '<br />'; } $prev = $offset-3; $next = $offset+3; echo "<br><a href='?offset={$prev}'>Prev</a> <a href='?offset={$next}'>Next</a>" Any ways, what this does is creates a list of three months with pagination for moving onto next three months or previous three months. I then am trying to build this piece of code from this topic, where it will find all events that fall underneath of the proper month(s). So I have an event called test1 with the dates of 3/15/2013 to 7/18/2013. What I then want it to do is display in a list like this Page 1 March 2013(heading from code I provided) 3/15/2013 - 7/18/2013 Test1 April 2013 3/15/2013 - 7/18/2013 Test1 May 2013 3/15/2013 - 7/18/2013 Test1 Page 2 June 2013 3/15/2013 - 7/18/2013 Test1 July 2013 3/15/2013 - 7/18/2013 Test1 August Left blank my table structure has start and end date and event name and id.
  6. barand, is there something I need to edit in the code you posted? not for sure. but I am receiving no results
  7. thats a good point, what is the best way to fix this?
  8. I am looking for a way to grab a start date and an end date from my database, and find out what months of what years the range covers. So for example, I have a march 15 2013 startdate, and a june 4 2013 enddate. I would like something that could tell me that this range covers march 2013, april 2013, may 2013, and july 2013. I know I could use a timestamp to find if a date falls within a specified month, but I can't figure out how I would reverse that into a months covered by range. any help is appreciated.
  9. I thought about a for loop, but the issue here being that how do I know what number to end on....there could be 1 item, there could be 100 items ordered. I plan to insert into a database each item that is sold individually for tracking purposes. So I guess I am asking, does paypal send a variable of how many items were purchased? I have been looking and can't seem to find one.
  10. so I do use item_name1/2/3/etc....but how can I dynamically create this list is my next question then.
  11. I am using paypal to integrate a shopping cart into my site. I would like to know if anyone knows how paypal sends POST variables when there are multiple items. So my customer orders 2 items, I know how to get one item, but how does paypal send both? do they use an array? an item_name_1/2? how do they post back? does anyone here know?if you can help me, that would be awesome.
  12. how do I do the foreach part though? do I do it inside the quotes? or does it happen outside the quotes....I need the loop to display inside of one cell.
  13. Currently I am working on an email script. I need to be able to use a foreach inside of the message. something like this: $message = '<table width="0" border="0" cellspacing="2" cellpadding="2"> <tr> <td>Registrant</td> <td>Event</td> <td>Date</td> <td>Time</td> <td>Participants</td> <td> </td> </tr> <tr> <td>'.$name.'</td> <td>'.$event.'</td> <td>'.$date.'</td> <td>'.$time.'</td> <td>'.foreach($_POST["participant"] AS $key => $val) { $participant = $val; echo $participant; }.'</td> <td> </td> </tr> </table>'; I know this isnot the proper way to do it, so I was wondering, what is the proper way to do this, or what is the best way to achieve this result? any help is greatly appreciated
  14. got it, one little "." was missing.
  15. Ok, I am still having an issue, but I think I figured out why the registrants are not displaying, its because the output is not displaying $output = " <tr>\n"; $output .= " <td>{$regDataAry['name']}</td>\n"; $output .= " <td>{$regDataAry['phone']}</td>\n"; $output .= " <td>{$regDataAry['email']}</td>\n"; $output .= " <td>{$paid}</td>\n"; $output .= " </tr>\n"; $output = " <tr>\n"; $output .= " <td colspan='4'>{$participants}</td>\n"; $output .= " </tr>\n"; return $output; this is what the view source returns: <tr> <td colspan='4'>5, 4, 3, 2, 1</td> </tr> <tr> <td colspan='4'>Bob, Aaron</td> </tr> <tr> <td colspan='4'>me, You, Aaron</td> </tr> meaning only the participant output is displaying....can anyone help me out?
  16. it also loops through data for each registrant. so if it has two registrants, it shows the first registrant's participants with the second....it builds up.....1st displays 1st. 2nd displays 1st and 2nd, etc. 5, 4, 3, 2, 1,Bob,||||||||||||||5, 4, 3, 2, 1, Bob, me, You similar to that kindof
  17. thanks!. biggest thing now is that it is only showing participant results, it is not showing any data from the registrant table. here is what I have <?php function registrantTable($regDataAry) { //Define paid status and make participant list comma separated $paid = (!empty($regDataAry['invoiceid'])) ? $regDataAry['invoiceid'] : 'no'; $participants = implode(', ', $regDataAry['participants']); //Create table for the registrant info $output = "<table>\n"; $output .= " <tr>\n"; $output .= " <td>{$regDataAry['name']}</td>\n"; $output .= " <td>{$regDataAry['phone']}</td>\n"; $output .= " <td>{$regDataAry['email']}</td>\n"; $output .= " <td>{$paid}</td>\n"; $output .= " </tr>\n"; $output = " <tr>\n"; $output .= " <td colspan='4'>{$participants}</td>\n"; $output .= " </tr>\n"; $output .= "</table>\n"; return $output; } $query = "SELECT r.id, r.name, r.phone, r.email, r.invoiceid, p.participant FROM registrants AS r INNER JOIN participants AS p ON p.registrant_id = r.id WHERE event_id='{$_GET['id']}' ORDER BY r.id"; $result = mysql_query($query); if(!$result) { echo "Query failed"; } elseif(!mysql_num_rows($result)) { echo "There were no matching records."; } else { $currentRegID = false; //Flag to track when reg id changes $registrantData = array(); //Temp array to hold set of data for a registrant while($row = mysql_fetch_assoc($result)) { //Check if registrant ID has changed if($currentRegID !== $row['id']) { //If not first record display records for previous registrant if(count($registrantData)) { echo registrantTable($registrantData); } //Set flag for current registrant $currentRegID = $row['id']; //Set "base" data for the current registrant $registrantData['name'] = $row['name']; $registrantData['phone'] = $row['phone']; $registrantData['email'] = $row['email']; $registrantData['invoiceid'] = $row['invoiceid']; } //Append particant to current registrant data $registrantData['participants'][] = $row['participant']; } //Display records for last registrant echo registrantTable($registrantData); }?> basically what you gave me. but how do I display both table results? I have never worked with inner join before
  18. This is kindof hard to explain, but what I am trying to do is query one database table getting an ID from it, and then querying another table using that ID, and the second table may have many references with that ID using TB1_id. Table one: id:1 Name:bob Table two: id:1 TB1_id:1 name:frank id:2 TB1_id:1 name:franky so when the query runs, it would display in a nice little table like this TB1 Name TB2name Bob frank, franky, here is what I have experimented with.... <?php $result = mysql_query("SELECT * FROM registrants where event_id='".$_GET['id']."'"); while($row = mysql_fetch_array($result)) { $id = $row['id']; $phone = $row['phone']; $email = $row['email']; $name = $row['name']; $paid = $row['invoiceid']; ?> <tr> <td><?php echo $name;?></td> <td><?php echo $phone; ?></td> <td><?php echo $email; ?></td> <td><?php if($paid ==''){echo 'no';} if($paid !==''){echo $paid; }?></td> <td> <?php echo $name; $result = mysql_query("SELECT * FROM participants where registrant_id='".$id."'"); while($row = mysql_fetch_array($result)) { $part = $row['participant']; ?> <?php echo $part; ?>, <?php echo $part; }?></td> </tr><?php } ?> </table> Sorry it is so (so,so,so,so,so) ugly....hopefully someone can help me make some sense of it.
  19. what format do I need to put it in in order to compare, and how do I go about comparing? I think I found a code that may be able to convert to different formats, but I need to know what format it needs to be in.
  20. I am forming the dates using jquery's datepicker. it shows up as that format and then stores it in a database. I then have a calendar that pulls the date from the database and places it in the calendar. I can't use another format for this, as it is how the calendar is designed to work....believe me, I have tried other formats. I will take a look at the link you provided. I guess maybe I could insert the date into two columns or something and do it that way maybe.
  21. I don't know how to describe it well. I want to compare two dates to each other....two in mm/dd/yyyy format. I want to see if date1 is greater that date2. How can I go about with this.
  22. ok.....so could you help me get started?
×
×
  • 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.