Jump to content

pgsjoe

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by pgsjoe

  1. [!--quoteo(post=358283:date=Mar 25 2006, 11:34 AM:name=annihilate)--][div class=\'quotetop\']QUOTE(annihilate @ Mar 25 2006, 11:34 AM) [snapback]358283[/snapback][/div][div class=\'quotemain\'][!--quotec--] Your variable $id is only specified if submit is not set. Therefore, your last query has no value for $id. Change the top of your script to this: [code]if($_GET['cmd']=="edit" || $_POST["cmd"]=="edit") {    $id = $_GET["id"];    if (!isset($_POST["submit"]))   {    $sql = "SELECT * FROM `calendar` WHERE id=$id";[/code] [/quote] Tried...didn't work. Still gives me the echo statement..."This event has been updated", but still not actually updating the database.
  2. So I've got it to pull the information from my database and put it into the form fields, but for some reason, when I hit submit, it's not going through. It's reading the correct area because I get the message stating that it has been updated. So, no syntax errors, it's just not Updating the database. [code]if($_GET['cmd']=="edit" || $_POST["cmd"]=="edit") {    if (!isset($_POST["submit"]))   {       $id = $_GET["id"];       $sql = "SELECT * FROM `calendar` WHERE id=$id";       $result = mysql_query($sql);               $myrow = mysql_fetch_array($result);       ?>        <div id="addevent"> <h1>EDIT Event Form</h1> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="edit" id="edit">       <input type="hidden" name="id" value="<?php echo $myrow["id"] ?>">   <p>       <b>Start Date: </b><input name="date" type="text" VALUE="<?php echo $myrow["date"] ?>"/>   </p>   <table border="0" cellpadding="0" cellspacing="0">     <tr>       <td width="120"><div align="right"><strong>Length of Event: </strong></div></td>       <td><INPUT TYPE="TEXT" NAME="remove" VALUE="<?php echo $myrow["remove"] ?>" SIZE=30></td>     </tr>   </table>   <br />   <table border="0" cellpadding="0" cellspacing="0">   <tr>     <td><p align="right"><b>Type: </b></p></td>     <td>    <select name="type" id="type">       <option value="Chapter" selected="selected">Chapter</option>       <option value="Regional">Regional</option>       <option value="National">National</option>     </select> </td>   </tr>   <tr>     <td width="120"><p align="right"><b>Chapter/Region/National: </b></p></td>     <td>    <INPUT TYPE="TEXT" NAME="chapter" VALUE="<?php echo $myrow["chapter"] ?>" SIZE=30></td>     </tr> </table>      <br />   <table border="0" cellpadding="0" cellspacing="0">     <tr>       <td width="120"><div align="right"><b>Event Title: </b></div></td>       <td><input type="text" name="title" size="35" VALUE="<?php echo $myrow["title"] ?>"/>         *</td>     </tr>     <tr>       <td width="120"><div align="right"><strong>Location: </strong> </div></td>       <td><input name="location" type="text" id="location" size="35" VALUE="<?php echo $myrow["location"] ?>"/></td>     </tr>     <tr>       <td width="120"><div align="right"><strong>Address:  </strong></div></td>       <td><input type="text" name="address" size="35" VALUE="<?php echo $myrow["address"] ?>"/></td>     </tr>   </table>   <table border="0" cellpadding="0" cellspacing="0">     <tr>       <td width="120"><div align="right"><strong>City: </strong></div></td>       <td><input type="text" name="city" size=35 VALUE="<?php echo $myrow["city"] ?>"/></td>     </tr>     <tr>       <td width="120"><div align="right"><strong>State: </strong></div></td>       <td><INPUT TYPE="TEXT" NAME="state" VALUE="<?php echo $myrow["state"] ?>" SIZE=30></td>     </tr>     <tr>       <td width="120"><div align="right"><strong>Zip: </strong></div></td>       <td><input type="text" name="zip" size=10 VALUE="<?php echo $myrow["zip"] ?>"/></td>     </tr>   </table>   <br />   <table border="0" cellpadding="0" cellspacing="0">     <tr>       <td width="120" valign="top"><div align="right"><b>Description: </b></div></td>       <td><textarea name="description" cols="40" rows="5" wrap="physical"><?php echo $myrow["description"] ?></textarea></td>     </tr>   </table>   <br />   <table border="0" cellpadding="0" cellspacing="0">     <tr>       <td width="120"><div align="right"><strong>Contact Email: </strong></div></td>       <td><input name="email" type="text" id="email" VALUE="<?php echo $myrow["email"] ?>"/></td>     </tr>     <tr>       <td width="120"><div align="right"><strong>Event web page: </strong></div></td>       <td><input type="text" name="website" size="35" VALUE="<?php echo $myrow["website"] ?>"/></td>     </tr>   </table>   <br />   <table border="0" cellpadding="0" cellspacing="0">     <tr>       <td width="120"><div align="right"><strong>Display Event: </strong></div></td>       <td><select name="select">         <option value="yes" selected="selected">yes</option>         <option value="no">no</option>       </select>       </td>     </tr>   </table>   <p><input type="submit" name="submit" value="submit"> </p>              <input type="hidden" name="cmd" value="edit"> </form> </div>    <?php }    if ($_POST["submit"])   {    $date = $_POST["date"];    $remove = $_POST["remove"];    $chapter = $_POST["chapter"];    $website = $_POST["website"];    $title = $_POST["title"];    $location = $_POST["location"];    $address = $_POST["address"];    $city = $_POST["city"];    $state = $_POST["state"];    $zip = $_POST["zip"];    $description = $_POST["description"];    $email = $_POST["email"];       $title = addslashes($title);    $description = addslashes($description);   $location = addslashes($location);              $sql = "UPDATE calendar SET        date='$date',        type='$type',        chapter='$chapter',        website='$website',        title='$title',        location='$location',        address='$address',        city='$city',        state='$state',        zip='$zip',        description='$description',        email='$email',           display='$display',        remove='$remove'        WHERE id='$id'";              //replace event with info from above          if (@mysql_query($sql)) {      echo '<p class="notice">This event has been updated. Way to go, champ!</p>';    } else {      echo '<p class="notice">Error adding submitted event: ' .          mysql_error() . '</p><p class="notice">Please contact our web support.</p>';    }           $result = mysql_query($sql);     } }[/code] Am I missing something completely obvious here?
  3. I have this... [code] $m = $_GET['m']; if ($m == "") {     $m = mktime(NULL, NULL, NULL, date('m'), 1, date('Y')); } $month = date("m", $m); $r = mysql_query("SELECT id, date FROM `calendar` WHERE date LIKE '%-$month-%'"); while ($line = mysql_fetch_row($r)) {     $days[$line[1]] = Array('#'.$line[0], 'linked-day'); } print_r($days); [/code] which gives me this... (the #numbers are the ID numbers which I'm setting up as anchor links). [code]Array (     [2006-03-30] => Array         (             [0] => #7             [1] => linked-day         )     [2006-03-16] => Array         (             [0] => #10             [1] => linked-day         )     [2006-03-01] => Array         (             [0] => #19             [1] => linked-day         )     [2006-03-15] => Array         (             [0] => #21             [1] => linked-day         ) )[/code] All I need is just the day without leading zeros, like this... [code]Array (     [30] => Array         (             [0] => #7             [1] => linked-day         )     [16] => Array         (             [0] => #10             [1] => linked-day         )     [1] => Array         (             [0] => #19             [1] => linked-day         )     [15] => Array         (             [0] => #21             [1] => linked-day         ) )[/code] I tried this... [code]    $days[substr($line[1],8)] = Array('#'.$line[0], 'linked-day'); [/code] and got leading zeros on single digit days... [code]Array (     [30] => Array         (             [0] => #7             [1] => linked-day         )     [16] => Array         (             [0] => #10             [1] => linked-day         )     [01] => Array         (             [0] => #19             [1] => linked-day         )     [15] => Array         (             [0] => #21             [1] => linked-day         ) )[/code] but [b]I need single digit days to return as [i]1[/i] instead of [i]01[/i][/b]. I also tried... [code] $days[date('j',$line[1])] = Array('#'.$line[0], 'linked-day');[/code] but got... [code]Array (     [31] => Array         (             [0] => #21             [1] => linked-day         ) )[/code] I'm completely out of options and need help!!!
  4. [!--quoteo(post=355463:date=Mar 15 2006, 02:51 PM:name=Steveo31)--][div class=\'quotetop\']QUOTE(Steveo31 @ Mar 15 2006, 02:51 PM) [snapback]355463[/snapback][/div][div class=\'quotemain\'][!--quotec--] What is "date is this date", how are you getting those dates, etc? [/quote] Thank you for asking! Guess I should have worded it better. WHERE date is this date... is suppose to be WHERE the date here is the same as the date pulled by the array. Though, thinking about it a bit more, I don't think I necessarily need to have the dates in the array link to a new sql query. Simply making them targets that point to the ID number would be just fine. So, here's the updated..."what I need to create" [code]$days = array(   //read database and if there is an event, of which there should be plenty...        day of event=>array('# . $id','linked-day' //I have no clue what this does), );[/code]
  5. I've been building this calendar for weeks now! One last step is all I need. I need to create this.... [code] $days = array(         2=>array('/weblog/archive/2004/Jan/02','linked-day'),         3=>array('/weblog/archive/2004/Jan/03','linked-day'),         8=>array('/weblog/archive/2004/Jan/08','linked-day'),         22=>array('/weblog/archive/2004/Jan/22','linked-day'),     ); [/code] What I need to have... [code] $days = array(   //read database and if there is an event, of which there should be plenty...        day of event=>array('$result = mysql query("SELECT * FROM `calendar` WHERE date is this date"),'linked-day' //I have no clue what this does),); [/code] Any ideas?
  6. Got it to work between the months/years....I missed one piece when integrating the code into mine. Just need to figure out the days array.
  7. thought it was working...turns out it won't go back to the previous year though. When you go to the month before January, it's only changing the month, and not the year. Here's what I'm pulling.... [code] //month to display calender for $m = $_GET['m']; if ($m == "") {     $m = mktime(NULL, NULL, NULL, date('m'), 1, date('Y')); } $month = date("m", $m); //$year = date("Y", $m); $prevmonth = mktime(NULL, NULL, NULL, $month-1, 1, date('Y')); $nextmonth = mktime(NULL, NULL, NULL, $month+1, 1, date('Y')); $today = mktime(NULL, NULL, NULL, date('m'), date('d'), date('Y')); $thismonth = date('m'); $time = $today; $backmonth = $_SERVER['PHP_SELF'] . '?m=' . $prevmonth; $forwardmonth = $_SERVER['PHP_SELF'] . '?m=' . $nextmonth;      $days = array($today=>array(NULL,NULL,'<span class="currentday">'.$today.'</span>')); $pn = array('&laquo;'=>$backmonth, '&raquo;'=>$forwardmonth); echo '<div id="side">'; echo generate_calendar(date('Y', $time), $month, $days, 0, NULL, 0, $pn); echo '<center>     <p class="addevent"><a href="' . $_SERVER['PHP_SELF'] .      '?addevent=1">Add Event</a></p>          </center></div>'; // Request all events $result = @mysql_query("SELECT * FROM `calendar` WHERE date LIKE '%-$month-%' AND date LIKE '$year%' GROUP BY date ASC, id ASC"); if (!$result) {    exit('<p>Error performing query: ' .        mysql_error() . '</p>'); } [/code] Alright...I'll probably have more questions after this, but at least I'll never ask the same question twice. - JoE -
  8. YES! This worked awesome for changing between months. Last gap I need to fill in is automating the days to fill in the calendar as links from the database. Help just a bit more please? - JoE -
  9. First off, I did the smart thing and searched Forums found some info but the other calendar systems didn't do exactly what I needed and figured I'm already halfway there so I'd just continue trying to work on mine, but I hit a brick wall and can't get anymore to work. So...if anybody has the time to figure this out, I would appreciate it. I can get all the info entered into the database and even to display correctly with all of the information I need. That was the easy part.. So now, I searched around and found a script that generates a whole month numerically (http://keithdevens.com/software/php_calendar). In describing the list he talks about setting up the days to show as links to specific events. He just lists them as links, but there has to be a way to automate this from my database, right? So that if there is an event on a specific day, I could make it a link to that event's information? Here's the page I'm working on: [a href=\"http://www.asse.org/calendar/index3.php\" target=\"_blank\"]http://www.asse.org/calendar/index3.php[/a] I'm also having quite the problem with arrows to go back and forth between month. I can get it to go one month in either direction but then it stops there. Here's the code for the month stuff.... [code]$next = $_SERVER['PHP_SELF'] . '?addmonth=1'; $last = $_SERVER['PHP_SELF'] . '?submonth=1'; if (isset($_GET['addmonth'])) {     $time = mktime(0, 0, 0, date("m")+1, date("d"), date("Y"));     } else if (isset($_GET['submonth'])) {     $time = mktime(0, 0, 0, date("m")-3, date("d"), date("Y"));     } else {     $time = time();     }     $today = date('j',$time); $month = date('m',$time); $year =  date('Y',$time); $days = array($today=>array(NULL,NULL,'<span class="currentday">'.$today.'</span>')); $pn = array('«'=>$last, '»'=>$next); echo '<div id="side">'; echo generate_calendar(date('Y', $time), $month, $days, 0, NULL, 0, $pn); echo '<center>     <p class="addevent"><a href="' . $_SERVER['PHP_SELF'] .      '?addevent=1">Add Event</a></p>          </center></div>'; // Request all events $result = @mysql_query("SELECT * FROM `calendar` WHERE date LIKE '%-$month-%' AND date LIKE '$year%' GROUP BY date ASC, id ASC"); if (!$result) {    exit('<p>Error performing query: ' .        mysql_error() . '</p>'); } [/code] As for the days being links, the code I got from it says to still use the generate_calendar function above and use this... [code] $days = array(         2=>array('/weblog/archive/2004/Jan/02','linked-day'),         3=>array('/weblog/archive/2004/Jan/03','linked-day'),         8=>array('/weblog/archive/2004/Jan/08','linked-day'),         22=>array('/weblog/archive/2004/Jan/22','linked-day'),         26=>array(NULL,'linked-day textual','twenty-six'),     ); [/code] but how would I get that to automatically pull events from my table. I know it'd have to be a SQL statement such as.. SELECT * FROM `calendar` WHERE date LIKE '%-$month-%' AND date LIKE '$year%' Any help is greatly appreciated. I've been struggling with this all last week and am really looking for some answers. - JoE -
×
×
  • 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.