Jump to content

krausehaus2

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

krausehaus2's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I found out what the problem was.  When you query the database for the events, it would only show the very last one on the calendar.  So what I did was loop it to where it would run a query for every day of the month.  That way it would find everything in the database per day.  Someone else had answered this question a while ago and I had wrote a reply thanking him and thought this had been closed out.
  2. I have a question about which to use around variables while sending a query to MS SQL.  If I try to use single quotations around a variable my users cannot use contractions (can't, don't etc.).  If I use quotation marks around my variable my users cannot use quotation marks. Okay to give you an idea of what is goin on I have written an online program for my employer to hold a customer database, computers that come in to get fixed get logged in, and the techs use the program to update online what they have done to the computer so that the customers can check online the status of their computer.  So when the techs try to use an appostrophe the database fails.  Here's an example:       $query = "Insert into pc_completed values (\"$customer_id\", \"$customer_lname\", \"$customer_fname\", \"$customer_address\", \"$customer_city\", \"$customer_state\", \"$customer_zip\", \"$customer_phone\", \"$alt_phone\", \"$admin_user\", \"$computer_problem\", \"$trc_store\", \"$customer_passwd\", \"$date_in\", \"$date_completed\", \"$customer_call_1\", \"$customer_call_2\", \"$work_completed\", \"$work_completed_1\", \"$work_completed_2\", \"$tech_assigned\", \"$reason_for_call_1\", \"$reason_for_call_2\");"; Using the quotation marks around the variable the techs can now use contractions.  But they cannot use quotation marks in the program itself.  When PHP sends it to the database the query fails.  If anyone knows why or has a helpfull hint it would be greatly appreciated.
  3. ;D I found my error!! Instead of having an if statement to see if the variable from the query is != to $days I changed it to if(empty($special_event)!! Woot!!  Thanks for all who helped..  :D
  4. You can try ereg().  it will look for a pattern of characters.  Like: if (ereg("cat", "raining cats and dogs")) {   echo "Found 'cat' "; it will print "found a cat" You probably could use that in a for loop looking through your array.
  5. Okay!! I got it working in the calendar!! woot!! But one problem.. Or should I say 5 problems. I am getting 5 error messages at the bottom of the page. PHP Notice: Undefined variable: event_date in E:\WebSites\TrcOnline\paul\concord_baptist\calendar_of_events.php on line 480.  Line 480 states if ($results).  This is for the query to the database.  If anyone can see why it would be greatly appreciated.  I think it might be for the 5 <tr>'s. Here's the code: if ($numerical_month == 10) {   $days = 1;   for($a = 1; $a <= $weeks_in_month; $a++)   {       for($x = 1; $x <= 1; $x++)       {         print "  <tr>";         for ($i = 1;$i <= $days_in_week; $i++)         {     if ($days <= 0) {   print "<td>";   print "--------";   print "</td>";   $days++; } if ($days > $days_in_month) {   print "<td align=\"center\">";   print "--------";   print "</td>";   $days++; }             else     {               $results = mssql_query("Select event_date, special_event from event_calendar where event_date = $days;", $connection);           if ($results) <---- here it is               {                    while ($row = mssql_fetch_array($results))                   {             $event_date = $row["event_date"]; $special_event = $row["special_event"];           }       if ($event_date != $days)   {         print "<td align=\"left\" valign=\"top\">"; print "$days";   }   else   {     print "<td align=\"left\" valign=\"top\">";                     print "$days<br>";         print "$special_event";   }       print "</td>";           $days++;           }         }         }         print "  </tr>";       }   } }  
  6. The perfect world would be where I could query the database in the for loop and have it only do one row from the database each time it ran through the loop.  The next line from the database that is...
  7. I am storing the event for only the days that they are on.  The problem is that the query to the database has to be done in a loop so it only shows the very last event from the database.
  8. yes the calendar is for one month.  Querying per day wouldn't be so bad.  The only problem with that is where I live most people are on dialup.  I live in the high mtns of NC and most people cannot get DSL, broadband, etc.  I'm gonna give it a shot though.  Thanks!
  9. I tried to have it pull up from the rows function but I still have to run the query using a for loop.  Am i going the wrong way with my calendar?
  10. If I use that will it not just get the first event from the database? Or will it go for the next event everytime it loops?
  11. I am creating a special events calendar in a web site for a local church.  I have the calendar already created, (hopefully the correct way), but when I query MSSQL I am only able to have the last event put into the calendar.  I have tried to put the query for the database almost everywhere in the code.  The only way I can get all three events in the calendar is to have three calendars show up.. lol..  If anyone can point me the correct way it would be very much appreciated.  Here is what I have coded..  I have the query commented out so the calendar works.  I am using and incDB page to connect to the database. Thanks if ($numerical_month == 10) {   $days = 1;   for($a = 1; $a <= $weeks_in_month; $a++)   {       for($x = 1; $x <= 1; $x++)       {         print "  <tr>";         for ($i = 1;$i <= $days_in_week; $i++)         { //         if ($results) //            { //              while ($row = mssql_fetch_array($results)) //              { //           $calendar_date = $row["calendar_date"]; //           $special_event = $row["special_event"]; //           $calendar_month = substr($calendar_date, 0, 2); //           $calendar_day = substr($calendar_date, 3, 2); //       if ($calendar_month == $numerical_month) //       { //         if ($calendar_day == $days) //         { //             print "$special_event"; //         } //   }             if ($days <= 0)         {             print "<td>";             print "--------";             print "</td>";             $days++;         }         elseif ($days > $days_in_month)         {             print "<td align=\"center\">";             print "--------";             print "</td>";             $days++;         }                     else             {                 print "<td align=\"left\" valign=\"top\">";                         print "$days<br>";                         print "</td>";                 $days++;                 }   }                   print "  </tr>"; //              } //close while //            } // close if //        } // close for       } // close for   } // close for } // close if
  12. I am trying to create a calendar that shows the specific special event on a certain date.  I have the calendar already created but when I query the database to put in the events, I can only put the last event in the calendar.  When I am querying the database I am using a while statement to retrieve the events.  Is there any other way I can work around 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.