Jump to content

hoopplaya4

Members
  • Posts

    161
  • Joined

  • Last visited

    Never

Posts posted by hoopplaya4

  1. That worked, thanks.  But the main point of my page is because it acts as an "archive" for all of the MySql records.  Thus, how might I display it in a way like below:

     

    > 2008

     

    > 2007

     

    > 2006, etc

     

    Then, a user will click the year, which will then spill out all the MySql records for that year.  Does that make sense?  Is there a tutorial anywhere out there that teaches how to make an archive?

  2. Hi All,

     

    I'm currently querying some database fields that are dates.  They are all in the following format: 11/12/2008.

     

    My question is this: How can I query the database to get all these fields, and then group them into separate (links) by Month.  For example, all the 11/xx/xxxx will be displayed under a link that would say "November."  Then users would click "November" and then all 11/xx/xxxx database entries would be displayed.

     

    Is this going to be too complicated?  Or is there an easy way to achieve this?  Please let me know if I'm being vague!  Thanks.

  3. I'm pretty new to this, but if someone could perhaps tell me what is wrong with my code, I'd much appreciate it!  I'm trying to execute a function, but I get the error:

     

    Fatal error: Call to undefined function viewPractice() in /home/content/c/o/a/coachrenke/html/test/secure/practice.php on line 12

     

    Here's my code:

     

    <?php
    session_start();
    require("includes/header.php");
    require("includes/secureHeader.php");
    
    if ($_POST['submit'] == null){
    
    if ($_SESSION['sessUsrFirstName'] != "") {
    
    if($_GET["action"] == "view") {
    
      viewPractice(); } // end if
    
    if ($_GET["action"] == "") {
    ?>
    <h1>Practices </h1>
    <a href="addPractice.php"><img src="../images/add.gif" border="0" /></a> <a href="addPractice.php">Add a Practice Plan</a><br /><br />
    <?php 
      require("../connection.php");
    $rs = mysql_db_query($DBname,$sql,$link);
    //Retrieves data from MySQL
    $data = mysql_query("SELECT * FROM tblPractices ORDER BY practiceDate LIMIT 10") or die(mysql_error());
    
    //Puts it into an array
    while($info = mysql_fetch_array( $data ))
    {
    
    //Outputs the list and other data
    Echo "<a href='practice.php?action=view&num=" . $info['practiceID'] . "'>".$info['practiceDate'] . "</a> <br>";
    } ?>
    
    <?php function viewPractice() {
    
    $sql = "SELECT * FROM tblPractices WHERE (practiceID = " .  $_GET["num"] . ")";
    
    require("../connection.php");
    
    $rs = mysql_db_query($DBname,$sql,$link);
    
    if ($rs) {
    
      while ($row=mysql_fetch_array($rs)){
    ?>
    <div id="communicate">
    <form class="uniForm" enctype="multipart/form-data" action="add.php" method="POST">
    <table width="80%" cellpadding="0">
    <div class="ctrlHolder">
    	<fieldset>
    	<legend>
    		Practice Date and File
    	</legend>
    		<input id="idhere" name="name" type="text" style="width: 80px;" maxlength="10" />
    		<div style="float:left" class="col">
    		<input type="file" class="fileUpload" name="photo" > 
    		</div>
    	</fieldset>
    	</div>
    	<div class="ctrlHolder">
    	<fieldset>
    	<legend>Comments</legend> 
    	<TEXTAREA id="styled" ols="115" rows="6" wrap="soft" type="text" name = "email" value="<?= $_GET["practiceComments"] ?>" ></TEXTAREA>
    	</fieldset>
    	</div>
    
    	<div class="ctrlHolder">
    	<fieldset>	
    	<legend>Private</legend>
    	 <TEXTAREA id="styled" wrap="soft" cols="115" rows="6" type="text" name = "phone"></TEXTAREA> 
    	</fieldset>
    	</div>
    
    	<div class="buttonHolder">
    		<fieldset>
    	<input class="submitButton" type="submit" value="Add Practice">
    	</fieldset>
    	</div>
    
    </table>
    </form>
    </div>
    
    
    <?php
    
      } //end while
    
    } // end if
    
    } // End Function editEvent
    
    
    
    } //end If
    
    } }
    ?>
    <?php  require("../includes/footer.php"); ?>

     

  4. Does anyone know of any scripts that will send an Instant Message (AIM, MSN, Google Talk, etc) via email or through a PHP script?

     

    I've been searching around and can't find anything.  I wonder if this is something that would have to be built from scratch.

     

    Thanks!

  5. Hi All,

     

    I've tried googling this for the past hour, but I haven't been able to find anything to help me.  I'm trying to insert 3 different fields (it's a phone number-- area code, prefix, suffix) into one row in my mySQL database.  How would I go about doing this?

     

    Here's my HTML:

     

    <label for="phone">Phone Number</label>
       <input type="text" size=3 maxlength="3" name="phone[]" id='phone[]'/>-
        <input type="text" size=3 maxlength="3" name="phone[]" id='phone[]'/>-
        <input type="text" size=4 maxlength="4" name="phone[]" id='phone[]'/>

     

    And here's my PHP Script:

     

    
    $usrPhone = str_replace("'", "''", $_POST["phone"]);
    
    $sql = "INSERT INTO tblUsers (usrPhone)";
    $sql .=" VALUES ('$usrPhone')";

     

    Thanks!

  6. Hi,

     

    I'm pulling several times from a MySQL database and putting into a table format in PHP.  However, the times right now come up as: 16:00:00, as opposed to 4:00 PM.  How can I query the database and convert it into a readable time? 

     

    Here's a quick look at my code:

     

      <?php
    
       $loopCount = 0;
    
       $sql = "SELECT classID, classTitle, classStart, classEnd, classDays";
       $sql .= " FROM tblCourses WHERE (usrID = " . $_SESSION['sessUsrID'] . ")";
       $sql .= " ORDER BY classID";
    
    
       require("../connection.php");
    
    
       $rs=mysql_db_query($DBname,$sql,$link);
    
        if ($rs) {
    
         while ($row=mysql_fetch_array($rs)){
    
         $daysSTR = $row['classDays'];
    
         $chars = array("M", "T", "W", "Th", "F", "S", "Su");
     $nums   = array("1", "2", "3", "4", "5", "6", "7");
    
         $daysSTR = str_replace($nums, $chars, $daysSTR);
         $daysSTR = str_replace(",", "", $daysSTR);
    
     $mysqltime = date ("Y-m-d H:i:s", $phptime);
    
         print(" <tr>\n");
         print("  <td>" . $row['classTitle'] . "</td>\n");
         print("  <td>" . $row['classStart'] . "</td>\n");
         print("  <td>" . $row['classEnd'] . "</td>\n");
         print("  <td>$daysSTR</td>\n");
     print("  <td><a href='editEvents.php?action=edit&num=" . $row['classID'] . "'>Edit</a>   ");
     print("<a href='editEvents.php?action=delete&num=" . $row['classID'] . "'>Delete</a></td>\n");
     print(" </tr>\n");
    
     $loopCount += 1;
    
    	} //end while
    
    	 if ($_GET["msg"] == 1){print("<tr>\n<td colspan=5><font color=red>Event Edited</td>\n</tr>\n");}
    
    	 if ($_GET["msg"] == 2){print("<tr>\n<td colspan=5><font color=red>Event Deleted</td>\n</tr>\n");}
    
    	 print("</table>\n</td>\n</tr>\n</table>");
    	 mysql_close($link);
      } // end if ($rs)
    
    else {  // No Events found
    
    print("No Events found");
    
    mysql_close($link);  } // end else ($rs)

     

    Thanks in advance for your help!!

  7. Hi All,

     

    Does anyone know of any PHP Scripts that would allow me to post a "Comment" or Private Message my friends on MySpace?

     

     

    I know that there are "Mass Comment" utilities out there, but I was curious if anyone knew of any that I could tie in with PHP somehow?

     

     

    Thanks!

  8. OK, so I figured out why it wasn't sending.  In emailscript.php the AddAddress command was not correct.  So, I changed it to:

     

    $mail->AddAddress($_POST["players"]);

     

    as opposed to the incorrect:

     

    $mail->AddAddress = ($_POST["players"]);

     

    Now, however, it will only work when I select one of the email addresses in the list.  However, if I try to hold CTRL, and select multiple email addresses, it will only send to one.

     

    Is there a way I can get it to send to several selected emails?    ???

  9. Hi revraz and andy:

     

    Thanks for the reply.  I tried to fix the '1' portion, but that didn't work.

     

    The specific issue is: the emails are not sending.  I am trying to select one email address (or multiple) and it is not sending to those addresses.  I am able to send to the whole database when I run a $row, however, I want to be able to send to selected email addresses.  Any other ideas?  Thanks again!

  10. Hi,

     

    I'm pretty new at PHP, and I've been searching the net for a while, but haven't been able to find anything conclusively to help me out.

     

    I'm trying to create an email form where the user can select multiple email addresses, pulled from the database, (see screenshot below) and send all selected users an email using PHPMailer.

     

    I've been trying to make it work, but just can't do it. If anyone can help out with the script, that'd be greatly appreciated!! Thank you. If you can help me out with both the PHP and HTML, that'd be VERY HELPFUL! Thank you.

     

    Here's the form code:

     

    <form name="filterplayer" method="post" action="emailscript.php">
        <select multiple name="players" id="players" size="5">
         <?php
    
          $sql = "SELECT usrID, usrEmail";
          $sql .= " FROM tblUsers";
          $sql .= " WHERE usrActive = 1";
          $sql .= " ORDER BY usrEmail";
    
            require("../connection.php");
    
               $rs=mysql_db_query($DBname,$sql,$link);
    
            if ($rs) {
    
              while ($row=mysql_fetch_array($rs)){
    
              print("<option value='" . $row["usrID"] . "'>");
                print("" . $row["usrEmail"] . "</option>\n");
                } // end while
    
                }
              else {  // No Events found
    
              print("No Active players");
    
         mysql_close($link);  } // end else ($rs)
    
        ?>
         </select>
         
         <br><br>
    
    <span class="style3">Subject</span><br />
    <input name="subjectpost" type="text" size="50" id="subjectpost"><br /><br />
    <span class="style3">Message</span><br />
    <textarea name="bodypost" cols="50" rows="10" id="bodypost"></textarea>
    <br /><br />
    <input type="submit" name="submit" value="Email!">
    
    </form>  

     

    And here's the PHP:

     

    <?php
    
    #include PHPMailer class and database connection
    include("../phpmailer/class.phpmailer.php");
    include("../connection.php");
    
    #remove slashes from content
    $html = stripslashes($_POST["bodypost"]);
    $plain = stripslashes($_POST["bodypost"]);
    
    
    #initiate PHPMailer class
    $mail = new PHPMailer();
    #set the from e-mail address
    $mail->From = "myemail@gmail.com";
    #set the from name
    $mail->FromName = "Scheduler";
    #set the e-mail type to HTML
    $mail->IsHTML(true);
    
    #the subject of the email
    $mail->Subject = stripslashes($_POST["subjectpost"]);
    #the HTML content of the email
    $mail->Body = $html;
    #the plain text version
    $mail->AltBody = $plain;
    
    #add subscribers address as the recipient
    $mail->AddAddress = ($_POST["players"]);
    #sends the newsletter
    $mail->Send();
    #clears the recipient address
    #$mail->ClearAddresses();
    
    ?> 

     

    optionqr5.th.jpgthpix.gif

×
×
  • 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.