Jump to content

law

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Posts posted by law

  1. ok great! i printed the array.. and come to find out it was NOT getting data! so i took out the where clause and now i have data! soo thats great.. and i added another row of dummy data unfortunately i now have a new issue..

    The that data is showing up in the form is only the first row of data.. how can i modify

    //----------EVENTDATA----------------
    $eventcount=0;
    While ($eventcount <= $events) {
    $eventdata= mysql_query("SELECT * FROM competitions WHERE competitionid <= $eventcount");
    $eventdatarow= mysql_fetch_array($eventdata);
    $ename=$eventdatarow['competitionname'];
    $efav=$eventdatarow['favorite'];
    $epts=$eventdatarow['pointspread'];
    $eund=$eventdatarow['underdog'];
    $emm=$eventdatarow['month'];
    $edd=$eventdatarow['day'];
    $eyyyy=$eventdatarow['year'];
    $eventcount++;
    }
    //----------EndOfDATA----------------
    echo "
    <TABLE BORDER=2 CELLPADDING=2 CELLSPACING=2 align=center WIDTH=720>
    <form name='eventsconfig' action='./adminconfig.php' method='POST'>
    <CAPTION ALIGN=TOP><B>Pool Form Setup Table</B><br/></CAPTION>
    <TR>
      <TH> Event Name</TH>
      <TH> Favorite Team</TH>
      <TH> Point Spread</TH>
      <TH> Underdog</TH>
      <TH> Event Date</TH>
    </TR>";
    while ($count <= $events){
    echo "
    <TR>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$ename' name='eventname'></TD>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$efav' name='eventfav'></TD>
      <TD align=center><input type='text' size='6' MAXLENGTH='6' value='$epts' name='eventpts'></TD>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$eund' name='eventund'>
      <TD align=center>
    	   <input type='text' size='2' MAXLENGTH='2' value='$emm' name='eventmonth'>
    	   <input type='text' size='2' MAXLENGTH='2' value='$edd' name='eventday'> 
    	   <input type='text' size='4' MAXLENGTH='4' value='$eyyyy' name='eventyear'> 
      </TD>
               <input type='hidden' value='$count' name='row'></TD>
    </TR>";
    $count++;
    }
    echo "
    </TABLE>
    <TABLE align=center>
    <TR>
    <TD>
    <input type='submit' name='eventsubmit' value='Add/Update Events'>
    <input type='reset' name='eventreset' value='Reset'><br/>
    </TD>
    </TR>
    </TABLE>
    </form>
    ";

    So that every line of the form represents its corresponding line of information from the database

    (Example: ID 1 [in database]= ROW 1 [in the form]) 

  2. I HAVE NOT INCLUDED THE ENTIRE PAGE..(for ease of read reasons) soo there might be a few $variables that are not defined one of them is $events = 32 (there is another mysql_fetch_array call used early in the page <not shown here> should i close that array fetch out in some way before calling another one??)

    My current problem is in the EVENT DATA section.. this is the section that is supposed to retrieve the data that is already within the database, and display it in the form below it.. the echo show that im doing something wrong.. im a novice soo this entire thing could be completely wrong but my intent is to show data already within the database on the form so that the user could update it.. hope that makes since thanks in advance (there is another mysql_fetch_array call used early in the page <not shown here> should i close that array fetch out in some way before calling another one??)

     

    //---------------------------------EVENTS/GAMES & TEAMS TABLE---------------------------------------------------
    //--------------FORM PROCESSOR---------------
    $var10 = $_POST['eventname'];
    $var11 = $_POST['eventfav'];
    $var12 = $_POST['eventpts'];
    $var13 = $_POST['eventund'];
    $var14 = $_POST['eventmonth'];
    $var15 = $_POST['eventday'];
    $var16 = $_POST['eventyear'];
    $var17 = $_POST['row'];
    
    echo "<br/><br/><br/>";
    if($var10=''){
    echo"Event name Missing";
    }
    if($var11=''){
    echo"Favorite Team Missing";
    }
    if($var12=''){
    echo"Point Spread Missing";
    }
    if($var13=''){
    echo"Underdog Team Missing";
    }
    
    //-------------------INSERT EVENT DATA QUERY-----------------------------------
    if($_POST['eventsubmit'] && is_numeric($_POST['eventmonth']) && is_numeric($_POST['eventday']) 
    && is_numeric($_POST['eventyear'])){
    $equery = "INSERT INTO competitions(competitionname,favorite,pointspread,underdog,month,day,year,competitionid)
    	     		  VALUES($var10,$var11,$var12,$var13,$var14,$var15,$var16,$var17)
       ON DUPLICATE KEY UPDATE competitionname = $var10, favorite = $var11, pointspread = $var12,
    		   	  underdog = $var13, month = $var14, day = $var15, year = $var16";
    $insertupdate= mysql_query($equery) or die(mysql_error());
            echo "<font color=orange><b>The events were successfully configured</b></font>";
    }
           
    //----------END OF FORM PROCESSOR------------
    //----------EVENTDATA----------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PROBLEM IS HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    $eventdata= mysql_query("SELECT * FROM competitions WHERE competitionid >= $events ");
    $eventdatarow= mysql_fetch_array($eventdata);
    $ename=$eventdatarow['competitionname'];
    $efav=$eventdatarow['favorite'];
    $epts=$eventdatarow['pointspread'];
    $eund=$eventdatarow['underdog'];
    $emm=$eventdatarow['month'];
    $edd=$eventdatarow['day'];
    $eyyyy=$eventdatarow['year'];
    //----------EndOfDATA----------------
    echo "$eventdata -- $eventdatarow -- $efav";
    // ECHO ABOVE AS SEEN ON WEBSIE                  resourceid 11 -- -- 
    echo "
    <TABLE BORDER=2 CELLPADDING=2 CELLSPACING=2 align=center WIDTH=720>
    <form name='eventsconfig' action='./adminconfig.php' method='POST'>
    <CAPTION ALIGN=TOP><B>Pool Form Setup Table</B><br/></CAPTION>
    <TR>
      <TH> Event Name</TH>
      <TH> Favorite Team</TH>
      <TH> Point Spread</TH>
      <TH> Underdog</TH>
      <TH> Event Date</TH>
    </TR>";
    
    while ($count <= $events){
    echo "
    <TR>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$ename' name='eventname'></TD>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$efav' name='eventfav'></TD>
      <TD align=center><input type='text' size='6' MAXLENGTH='6' value='$epts' name='eventpts'></TD>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$eund' name='eventund'>
      <TD align=center>
    	   <input type='text' size='2' MAXLENGTH='2' value='$emm' name='eventmonth'>
    	   <input type='text' size='2' MAXLENGTH='2' value='$edd' name='eventday'> 
    	   <input type='text' size='4' MAXLENGTH='4' value='$eyyyy' name='eventyear'> 
      </TD>
               <input type='hidden' value='$count' name='row'></TD>
    </TR>";
    $count++;
    }
    echo "
    </TABLE>
    <TABLE align=center>
    <TR>
    <TD>
    <input type='submit' name='eventsubmit' value='Add/Update Events'>
    <input type='reset' name='eventreset' value='Reset'><br/>
    </TD>
    </TR>
    </TABLE>
    </form>
    ";
    //---------------------------------END OF EVENTS/GAMES & TEAMS TABLE--------------------------------------------

     

    FULL PAGE OF CODE FOR THOSE WHO LIKE TO READ

    <div id="stuff">
    <?php
    session_start();
    if(isset($_SESSION['admin_user'])){
    $tmp=$_SESSION['admin_user'];
    // Config fields to determine pool amount, pool charge, last day to enter, refferral reward
    //  Fields to add game name and teams in the game as well as point spread
    //  Ability to select which config to load and run
    include_once("./dbconfig.php");
    include_once("./includes/potmath.inc");
    
    //-------------------FORM PROCESSOR--------------------------------------
    if($_POST['submit'] && is_numeric($_POST['month']) && is_numeric($_POST['day']) 
    && is_numeric($_POST['year']) && is_numeric($_POST['events'])
    && ($_POST['entryprice']) > ($_POST['potamount']) && ($_POST['refreward']) <= '1.00'
    && ($_POST['firstplace']) + ($_POST['secondplace']) + ($_POST['thirdplace']) < '101'
    && ($_POST['firstplace']) + ($_POST['secondplace']) + ($_POST['thirdplace']) > '99') {
    $var1 = $_POST['entryprice'];
    $var2 = $_POST['potamount'];
    $var3a = $_POST['month'];
    $var3b = $_POST['day'];
    $var3c = $_POST['year'];
    $var4 = $_POST['refreward'];
    $var5 = $_POST['firstplace'];
    $var6 = $_POST['secondplace'];
    $var7 = $_POST['thirdplace'];
    $var8 = $_POST['events'];
    $update= mysql_query("UPDATE config SET poolamount = $var1, poolcharge = $var2, lastmonth = $var3a,
    	lastday = $var3b, lastyear = $var3c, refferralreward = $var4,
    	1stplace = $var5, 2ndplace = $var6, 3rdplace = $var7, events = $var8 WHERE configid = 1") or die(mysql_error());
            echo "<font color=orange><b>The pool was successfully configured</b></font>";
            }
    //-------------------END OF FORM PROCESSOR-------------------------------
    
    //-------------------------TABLE------------------------------------------
    
    $data= mysql_query("SELECT * FROM config WHERE configid = 1 ");
    $datarow= mysql_fetch_array($data);
    $poolamount=$datarow['poolamount'];
    $poolcharge=$datarow['poolcharge'];
    $lastmonth=$datarow['lastmonth'];
    $lastday=$datarow['lastday'];
    $lastyear=$datarow['lastyear'];
    $refreward=$datarow['refferralreward'];
    $firstplace=$datarow['1stplace'];
    $secondplace=$datarow['2ndplace'];
    $thirdplace=$datarow['3rdplace'];
    $events=$datarow['events'];
    
    echo "
    <TABLE BORDER=2 CELLPADDING=2 CELLSPACING=2 align=center>
    <CAPTION ALIGN=TOP><B>The Current Configuration of the Pool</B></CAPTION>
    <TR>
      <TH> Entry Price</TH>
      <TH> Pot Amount</TH>
      <TH> Last Day to Enter</TH>
      <TH> Referral Reward</TH>
      <TH> Events</TH>
      <TH> 1st Place</TH>
      <TH> 2nd Place</TH>
      <TH> 3rd Place</TH>
    </TR>
    <TR>
      <TD align=center>$poolamount</TD>
      <TD align=center>$poolcharge</TD>
      <TD align=center>$lastmonth/$lastday/$lastyear</TD>
      <TD align=center>$refreward</TD>
      <TD align=center>$events</TD>
      <TD align=center>$firstplace %</TD>
      <TD align=center>$secondplace %</TD>
      <TD align=center>$thirdplace %</TD>
    </TR>
    </TABLE>
    ";
    //----------------------------------END OF TABLE-------------------------------------------------------
    
    
    //-------------------------RECONFIG TABLE------------------------------------------
    echo "<br/>
    <TABLE BORDER=2  align=center WIDTH=690>
    <form name='adminconfig' action='./adminconfig.php' method='POST'>
    <CAPTION ALIGN=TOP><B>The Re-Configuration of the Pool</B></CAPTION>
    <TR>
      <TH> Entry Price</TH>
      <TH> Pot Amount</TH>
      <TH> Last Day to Enter</TH>
      <TH> Referral Reward</TH>
      <TH> Events</TH>
      <TH> 1st Place</TH>
      <TH> 2nd Place</TH>
      <TH> 3rd Place</TH>
    </TR>
    <TR>
      <TD align=center><select name='entryprice'>
    <option value='5'>5</option>
    <option value='8'>8</option>
    <option value='10'>10</option>
    <option value='12'>12</option>
    <option value='15'>15</option>
    <option value='18'>18</option>
    <option value='20'>20</option>
    <option value='25'>25</option>
    <option value='30'>30</option>
    <option value='35'>35</option>
    <option value='40'>40</option>
    <option value='45'>45</option>
    <option value='50'>50</option>
    </select></TD>
      <TD align=center><select name='potamount'>
    <option value='3'>3</option>
    <option value='5'>5</option>
    <option value='7'>7</option>
    <option value='10'>10</option>
    <option value='12'>12</option>
    <option value='15'>15</option>
    <option value='18'>18</option>
    <option value='22'>22</option>
    <option value='27'>27</option>
    <option value='30'>30</option>
    <option value='35'>35</option>
    <option value='40'>40</option>
    <option value='45'>45</option>
    </select></TD>
      <TD>
    <input type='text' size='2' MAXLENGTH='2' value='mm' name='month'>
    <input type='text' size='2' MAXLENGTH='2' value='dd' name='day'> 
    <input type='text' size='4' MAXLENGTH='4' value='yyyy' name='year'> 
    </TD>
      <TD align=center><input type='text' size='3' MAXLENGTH='4' value='0.50' name='refreward'>
    </TD>
      <TD align=center><input type='text' size='2' MAXLENGTH='2' value='32' name='events'>
    </TD>
      <TD align=center><select name='firstplace'>
    <option value='100'>100%</option>
    <option value='90'>90%</option>
    <option value='80'>80%</option>
    <option value='70'>70%</option>
    </select></TD>
      <TD align=center><select name='secondplace'>
    <option value='0'>0%</option>
    <option value='8'>8%</option>
    <option value='15'>15%</option>
    <option value='20'>20%</option>
    </select></TD>
      <TD align=center><select name='thirdplace'>
    <option value='0'>0%</option>
    <option value='2'>2%</option>
    <option value='5'>5%</option>
    <option value='10'>10%</option>
    </select></TD>
    </TR>
    </TABLE>
    <TABLE align=center>
    <TR>
    <TD>
    <input type='submit' name='submit' value='Re-Configure the Pool'>
    <input type='reset' name='reset' value='Reset'><br/>
    </TD>
    </TR>
    </TABLE>
    </form>
    ";
    //----------------------------------END OF RECONFIG TABLE-------------------------------------------------------
    //------------------TEXT------------------------
    echo "<b><font color=orange>**Make sure that your Entry Price is ABOVE the Pot Amount**</font></b><br/>
    <b><font color=orange>**Make sure that your Placement %'s = 100%**</font></b><br/>
    <font size=0.005>*The <u>entry price</u> the the price the user pays to enter. The <u>pot amount</u> is how much money from the entry price actually enters into the pool.</font><br/>
    <font size=0.005>*The <u>referral reward</u> is the amount the user makes for a paying referral.</font><br/>
    <font size=0.005>*The <u>Events</u> is the amount GAMEs that will be in the pool.</font>
    ";
    //------------------END OF TEXT------------------------
    //---------------------------------EVENTS/GAMES & TEAMS TABLE---------------------------------------------------
    //--------------FORM PROCESSOR---------------
    $var10 = $_POST['eventname'];
    $var11 = $_POST['eventfav'];
    $var12 = $_POST['eventpts'];
    $var13 = $_POST['eventund'];
    $var14 = $_POST['eventmonth'];
    $var15 = $_POST['eventday'];
    $var16 = $_POST['eventyear'];
    $var17 = $_POST['row'];
    
    echo "<br/><br/><br/>";
    if($var10=''){
    echo"Event name Missing";
    }
    if($var11=''){
    echo"Favorite Team Missing";
    }
    if($var12=''){
    echo"Point Spread Missing";
    }
    if($var13=''){
    echo"Underdog Team Missing";
    }
    
    //-------------------INSERT EVENT DATA QUERY-----------------------------------
    if($_POST['eventsubmit'] && is_numeric($_POST['eventmonth']) && is_numeric($_POST['eventday']) 
    && is_numeric($_POST['eventyear'])){
    $equery = "INSERT INTO competitions(competitionname,favorite,pointspread,underdog,month,day,year,competitionid)
    	     		  VALUES($var10,$var11,$var12,$var13,$var14,$var15,$var16,$var17)
       ON DUPLICATE KEY UPDATE competitionname = $var10, favorite = $var11, pointspread = $var12,
    		   	  underdog = $var13, month = $var14, day = $var15, year = $var16";
    $insertupdate= mysql_query($equery) or die(mysql_error());
            echo "<font color=orange><b>The events were successfully configured</b></font>";
    }
           
    //----------END OF FORM PROCESSOR------------
    //----------EVENTDATA----------------
    $eventdata= mysql_query("SELECT * FROM competitions WHERE competitionid >= $events ");
    $eventdatarow= mysql_fetch_array($eventdata);
    $ename=$eventdatarow['competitionname'];
    $efav=$eventdatarow['favorite'];
    $epts=$eventdatarow['pointspread'];
    $eund=$eventdatarow['underdog'];
    $emm=$eventdatarow['month'];
    $edd=$eventdatarow['day'];
    $eyyyy=$eventdatarow['year'];
    //----------EndOfDATA----------------
    echo "$eventdata -- $ename -- $efav";
    echo "
    <TABLE BORDER=2 CELLPADDING=2 CELLSPACING=2 align=center WIDTH=720>
    <form name='eventsconfig' action='./adminconfig.php' method='POST'>
    <CAPTION ALIGN=TOP><B>Pool Form Setup Table</B><br/></CAPTION>
    <TR>
      <TH> Event Name</TH>
      <TH> Favorite Team</TH>
      <TH> Point Spread</TH>
      <TH> Underdog</TH>
      <TH> Event Date</TH>
    </TR>";
    
    while ($count <= $events){
    echo "
    <TR>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$ename' name='eventname'></TD>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$efav' name='eventfav'></TD>
      <TD align=center><input type='text' size='6' MAXLENGTH='6' value='$epts' name='eventpts'></TD>
      <TD align=center><input type='text' size='20' MAXLENGTH='20' value='$eund' name='eventund'>
      <TD align=center>
    	   <input type='text' size='2' MAXLENGTH='2' value='$emm' name='eventmonth'>
    	   <input type='text' size='2' MAXLENGTH='2' value='$edd' name='eventday'> 
    	   <input type='text' size='4' MAXLENGTH='4' value='$eyyyy' name='eventyear'> 
      </TD>
               <input type='hidden' value='$count' name='row'></TD>
    </TR>";
    $count++;
    }
    echo "
    </TABLE>
    <TABLE align=center>
    <TR>
    <TD>
    <input type='submit' name='eventsubmit' value='Add/Update Events'>
    <input type='reset' name='eventreset' value='Reset'><br/>
    </TD>
    </TR>
    </TABLE>
    </form>
    ";
    //---------------------------------END OF EVENTS/GAMES & TEAMS TABLE--------------------------------------------
    
    } else {
    header('Location:admin.php?notloggedin=1');
    }
    ?>
    </div>

  3. Ok my code works just fine like it is.. how can i make the check box process the form instantly without the user having to click the submit button??

     

    <div id="stuff">
    <?php
    //	a table showing the users who have and have not payed so that they can be deleted from the database
    include_once("./dbconfig.php");
    $q="SELECT * FROM members WHERE id > 0";
    $sql=mysql_query($q);
    
    if ($_GET['userpaymenterror']){
    echo '<font color=orange>The user with an ID of the above listed error number does not meet the requirements in order to post their payment.</font>';
    }
    echo "<table border=1 align=center><CAPTION ALIGN=TOP><B>Member Table!</B></CAPTION>
    <tr align=center>
    <td><b>ID</b></td>
    <td><b>Nickname</b></td>
    <td><b>Email</b></td>
    <td><b>Name</b></td>
    <td><b>Payment</b></td>
    <td><b>Picks</b></td>
    <td><b>Refferals</b></td>
    <td><b>Confirm Pay</b></td>
    </tr>";
    			$rcount="0";
    			$color1 = "#003300";
    			$color2 = "#000066";
    
    while ($row=mysql_fetch_array($sql)) {
    $rcolor = ($rcount%2)?$color1:$color2;
    $nickname=$row['nickname'];
    $email=$row['email'];
    $name=$row['name'];
    $payment=$row['payment'];
    $picks=$row['picks'];
    $refferral=$row['refferralamount'];
    $userid=$row['id'];
    $usernumber=$userid['id'];
    echo "
    <tr align=center><form name='Payment' action='./paidconfirmed.php' method='post' enctype='multipart/form-data'>
    	<td bgcolor=$rcolor align=left>$userid</td>
    	<td bgcolor=$rcolor align=left>$nickname</td>
    	<td bgcolor=$rcolor align=left>$email</td>
    	<td bgcolor=$rcolor align=left>$name</td>
    	<td bgcolor=$rcolor align=center>$payment</td>
    	<td bgcolor=$rcolor align=center>$picks</td>
    	<td bgcolor=$rcolor align=center>$refferral</td>
    	<td bgcolor=$rcolor align=center><input type='checkbox' name='paid' value='$usernumber'>
    	</tr>";
    $rcount++;
    }
    echo "</table>
    <p align=center>
    <input type='submit' value='Submit'>    <input type='reset' value='Reset'>
    </p>
    </form>";
    ?>
    </div>

  4. <label>Graduating Class (numbers only! example:'1999'):</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="GraduatingClass"
                    size="4" /><br>

     

    So how can i produce a java script form checker to make sure they only enter numbers? or is there some "type" of form input field that only allows numbers? here is my current script it only checks to make sure that the user has entered something in every input field.

     

    if (document.Register.GraduatingClass.value=="")
    {
    alert("Don't forget to enter your Graduating Class!")
    document.Register.GraduatingClass.focus();return false
    }

  5. I am inexperienced with databases and coding in general. I am getting this error "Incorrect integer value: '' for column 'GraduatingClass' at row 1"  I know the problem is with my database, but i don't understand them well enough to know how it should be done. Also how can I validate my form so that users do not insert incorrect data? Apparently what I have is not working?

     

    FORM

    <div id="">
    <?php session_start(); 
    if(isset($_SESSION['ses_user'])){
    $ses = $_SESSION['ses_user'];
    echo $ses;
    }
    ?>
    <script type="text/javascript"
          src="javascript.js">
    </script>
    <script language="Javascript" type="text/javascript">
    //This is the javascript function that validates fields on the form. 
    
    function CheckTheForm()
    {
    if (document.Register.Name.value=="")
    {
    alert("Name is Required!")
    document.Register.Name.focus();return false
    }
    
    if (document.Register.Email.value=="")
    {
    alert("Email is Required!")
    document.Register.Email.focus();return false
    }
    
    if (document.Register.userid.value=="")
    {
    alert("Don't forget to enter user name!")
    document.Register.userid.focus();return false
    }
    if (document.Register.password.value=="")
    {
    alert("Don't forget to enter your password!")
    document.Register.password.focus();return false
    }
    if (document.Register.FirstName.value=="")
    {
    alert("Don't forget to enter your First Name!")
    document.Register.First Name.focus();return false
    }
    if (document.Register.MiddleName.value=="")
    {
    alert("Don't forget to enter your Middle Name!")
    document.Register.MiddleName.focus();return false
    }
    if (document.Register.LastName.value=="")
    {
    alert("Don't forget to enter your Last Name!")
    document.Register.LastName.focus();return false
    }
    if (document.Register.GraduatingClass.value=="")
    {
    alert("Don't forget to enter your Graduating Class!")
    document.Register.GraduatingClass.focus();return false
    }
    if (document.Register.City.value=="")
    {
    alert("Don't forget to enter your City!")
    document.Register.City.focus();return false
    }
    if (document.Register.State.value=="")
    {
    alert("Don't forget to enter your State!")
    document.Register.State.focus();return false
    }
    if (document.Register.Address.value=="")
    {
    alert("Don't forget to enter your Address!")
    document.Register.Address.focus();return false
    }
    if (document.Register.ZipCode.value=="")
    {
    alert("Don't forget to enter your ZipCode!")
    document.Register.ZipCode.focus();return false
    }
    if (document.Register.PhoneNumber.value=="")
    {
    alert("Don't forget to enter your PhoneNumber!")
    document.Register.PhoneNumber.focus();return false
    }
    if (document.Register.Nickname.value=="")
    {
    alert("Don't forget to enter your Nickname!")
    document.Register.Nickname.focus();return false
    }
    //This does validation of a valid email address... it cannot validate that the address works, but that it is 
    //formatted like an email address should be (something@something.something)
    
    if (document.Register.Email.value != "")
    {if (document.Register.Email.value.indexOf("@") == -1 ||
    document.Register.Email.value.length < 7)
    {alert("Sorry your email address is not valid");
      document.Register.Email.focus();return false}
    }
    }
    
    </script>
    
            <?php
            if(!array_key_exists('formMessage', $_SESSION))
            $_SESSION['formMessage'] = "";
            if(!array_key_exists('form_element0', $_SESSION))
            $_SESSION['form_element0'] = "";
            if(!array_key_exists('form_element1', $_SESSION))
            $_SESSION['form_element1'] = "";
            if(!array_key_exists('form_element2', $_SESSION))
            $_SESSION['form_element2'] = "";
            if(!array_key_exists('form_element3', $_SESSION))
            $_SESSION['form_element3'] = "";
            ?>
    
            <div class="message-text">
              <?php
              if ($_GET['userexist'] == 1){
    			echo '<font color=red>This username already exists. Check the spelling or try another name. </font><p>';
    		}
    //          if (!$_POST['formMessage']) { 
              	echo 'Fill in the form below to open an account. We are also going to save your contact information to keep you up to date on the chapter. Please check back often with the Alumni Connection the site will be undergoing massive overhauls within the near future! To provide our alumni with alot of useful features, (including fantasy football) Thank you!';
    //          } else {
    //           echo $_POST['formMessage'];
    //           }
               ?>
            </div>
            <br />
    
            <form name="Register" action="./thank.php"
                  method="post"
                  enctype="multipart/form-data" onsubmit="return CheckTheForm()">
              <label>Your Name:</label>
              <br />
              <input class="form-input-field"
                    type="text"
                    name="FirstName"
                    size="30" /><br>
    
              <label>Middle Name:</label>
              <br />
              <input class="form-input-field"
                    type="text"
                    name="MiddleName"
                    size="30" /><br>
      
              <label>Last Name:</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="LastName"
                    size="30" />
              <br>
    	  <br>
    	  <label>Graduating Class (numbers only! example:'1999'):</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="GraduatingClass"
                    size="4" /><br>
    	  <label>Nick Name (if you had one):</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="Nickname"
                    size="30" />
              <br>
    	  <br>
              <label>City:</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="City"
                    size="30" /><br>
    
              <label>State:</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="State"
                    size="30" /><br>
    
              <label>Address:</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="Address"
                    size="30" /><br>
    
              <label>Zipcode:</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="ZipCode"
                    size="5" />
              
              <br />          
              <br />
              <label>Phone Number (numbers only no dashes):</label>    
              <br />
              <input class="form-input-field"
                    type="text"
                    name="PhoneNumber"
                    size="10" />
              <br />
              <label>Email:</label>
              <br />
              <input class="form-input-field"
                    type="text"
                    name="Email"
                    size="40" />
              <br />
              <br />
              <label>User Name:</label>
              <br />
              <input class="form-input-field"
                    type="text"
                    name="userid"
                    size="40" />
              <br />
              <br />
              <label>Password:</label>
              <br />
              <input class="form-input-field"
                    type="password"
                    name="password"
                    size="40" />
              <br />
              <br />
              <input class="form-input-button"
                    type="reset"
                    name="resetButton"
                    value="Reset" /> 
              <input class="form-input-button"
                    type="submit"
                    name="submitButton"
                    value="Submit" />
            </form><?php session_destroy(); ?>
    </div>

     

    thank.php (form processor)

    <?php 
    session_start();
    //if(isset($_SESSION['ses_user'])){
    //	$tmp=$_SESSION['ses_user'];	
    $var0 = stripslashes($_POST['userid']);
    $var1 = $_POST['FirstName'];
    $var2 = $_POST['MiddleName'];
    $var3 = $_POST['LastName'];
    $var4 = $_POST['GraduatingClass'];
    $var5 = $_POST['Nickname'];
    $var6 = $_POST['City'];
    $var7 = $_POST['State'];
    $var8 = $_POST['Address'];
    $var9 = $_POST['ZipCode'];
    $var10 = $_POST['PhoneNumber'];
    $var11 = $_POST['Email'];
    $var12 = $_POST['Password'];
    
    include("./dbconfig.php");
    $sql = mysql_query("SELECT * FROM members WHERE nickname = '$var0'") or die(mysql_error());
    $num = mysql_num_rows($sql);
    //echo "$var3";
    //		include_once('./includes/head.inc');
    //		include_once('./includes/logo.inc');
    //		include_once('./includes/registrationmenu.inc'); 	
    	if ($num ==0){
    	$result = mysql_query("INSERT INTO members(FirstName, MiddleName, LastName, GraduatingClass, Nickname, City, State, Address, Zip, PhoneNumber, Email, UserName, Password)
    										VALUES('$var1', '$var2', '$var3', '$var4', '$var5', '$var6', '$var7', '$var8', '$var9', '$var10', '$var11', '$var0' ,'$var12')") or die(mysql_error());
    // echo "$result";
    	print "** Thank you <B><font color=#adfcff>";
    	print "$var1 $var2 $var3";
    	print "</B></font> for registering with us. **";
    	print "PLEASE CHECK BACK OFTEN FOR UPDATES";
    } else {
    
    	header("Location:./index.php?userexist=1");
    }
    //	include_once('./includes/indexbody.inc');
    //	include_once('./includes/footer.inc');      
    //} else {
    //	header('Location:index.php?notloggedin=1');
    //}
    ?>

     

    TABLE (once again i'm not good at making tables)

    /*Column Information For - sigepalumni.members*/
    ------------------------------------------------
    
    Field            Type         Collation          Null    Key     Default  Extra           Privileges                       Comment
    ---------------  -----------  -----------------  ------  ------  -------  --------------  -------------------------------  -------
    id               int(4)       (NULL)             NO      PRI     (NULL)   auto_increment  select,insert,update,references         
    FirstName        varchar(30)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    MiddleName       varchar(30)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    LastName         varchar(30)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    GraduatingClass  year(4)      (NULL)             YES             (NULL)                   select,insert,update,references         
    City             varchar(30)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    State            varchar(30)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    Address          varchar(30)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    Zip              int(5)       (NULL)             YES             (NULL)                   select,insert,update,references         
    PhoneNumber      int(10)      (NULL)             YES             (NULL)                   select,insert,update,references         
    Nickname         varchar(15)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    UserName         varchar(15)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    Password         varchar(15)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    Email            varchar(30)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
    DateRegistered   date         (NULL)             YES             (NULL)                   select,insert,update,references         
    
    /*Index Information For - sigepalumni.members*/
    -----------------------------------------------
    
    Table    Non_unique  Key_name  Seq_in_index  Column_name  Collation  Cardinality  Sub_part  Packed  Null    Index_type  Comment
    -------  ----------  --------  ------------  -----------  ---------  -----------  --------  ------  ------  ----------  -------
    members           0  PRIMARY              1  id           A                    0    (NULL)  (NULL)          BTREE              
    
    /*DDL Information For - sigepalumni.members*/
    ---------------------------------------------
    
    Table    Create Table                               
    -------  -------------------------------------------
    members  CREATE TABLE `members` (                   
               `id` int(4) NOT NULL auto_increment,     
               `FirstName` varchar(30) default NULL,    
               `MiddleName` varchar(30) default NULL,   
               `LastName` varchar(30) default NULL,     
               `GraduatingClass` year(4) default NULL,  
               `City` varchar(30) default NULL,         
               `State` varchar(30) default NULL,        
               `Address` varchar(30) default NULL,      
               `Zip` int(5) default NULL,               
               `PhoneNumber` int(10) default NULL,      
               `Nickname` varchar(15) default NULL,     
               `UserName` varchar(15) default NULL,     
               `Password` varchar(15) default NULL,     
               `Email` varchar(30) default NULL,        
               `DateRegistered` date default NULL,      
               PRIMARY KEY  (`id`)                      
             ) ENGINE=InnoDB DEFAULT CHARSET=latin1     
    

  6. How can i make an onclick checkbox that inserts data into my database?

    all i want is for the checkbox upon being clicked to change the value of my picks column in my database between 1 and 0. 1 if the box is checked and 0 if it is not. Here is the query that selects the column i wish to edit. "SELECT paid FROM members WHERE id = "$id""

    I literally know nothing about javascript so im looking for the exact code or some good explanation.. because if i have to edit the code myself there is a 50% chance i will screw it up! thanks guys! i appreciate your time

  7. that just dawned on me aswell, i was just using a suggestion that someone gave me a while ago... so here is they new code.. im completely new to loops and things so i have no idea why this doesn't work

     

    include_once("./dbconfig.php");
    if (isset($_SESSION['admin_user'])){
    $tmp=$_SESSION['admin_user'];
    $adminq="SELECT news FROM news WHERE viewership > 0";
    $adminsql=mysql_query($adminq);	
    //$adminrow=mysql_fetch_assoc($adminsql);
    //echo "$adminsql";
    $ii=0;
    $num =mysql_num_rows($adminsql);
    $row = mysql_fetch_row($adminsql);
    echo "<table width='100' align='center'>";
    for($i=0; $i<=$num; $i=$i+1)
    {
    	if($i % 2 == 0)
    	{
    		echo "<tr>";
    		echo "<td style='background-color:blue'>";
    		echo $row[$i];
    		echo "</td>";
    		echo "</tr>";
    	}
    	else
    	{
    		echo "<tr>";
    		echo "<td style='background-color:none'>";
    		echo $row[$i];
    		echo "</td>";
    		echo "</tr>";
    	}
    }
    echo "</table>";
    {
    else}
    {
    ?>
    

     

    im trying to get the $row to increment itself to display all of the news instead of the news that is @ array 0.. how can i do this.. (currently it only displays "hgjkhgkjhgkjghjkhgkjhgk newline extendedpastthebox-----------" which is my test text)

     

  8. Ok i did what you said, and i also cut out the other parts of the code im not using currently.

    Here is what i have now

    <?php
    include_once("./dbconfig.php");
    if (isset($_SESSION['admin_user'])){
    $tmp=$_SESSION['admin_user'];
    $adminq="SELECT news FROM news WHERE viewership > 0";
    $adminsql=mysql_query($adminq);	
    //$adminrow=mysql_fetch_assoc($adminsql);
    //echo "$adminsql";
    $i=0;
    while($row = mysql_fetch_row($adminsql)){
    			foreach($row as $key => $value){
    				$data[$i][$key] = $value;
    			}
    			$i++;
    		}
    		print_r($data[0]);
    //==================================================================	
    //	} elseif (isset($_SESSION['ses_user'])){
    //				$tmp=$_SESSION['ses_user'];
    //==================================================================
    		} else {
    
    		}

    here is what it prints

    "Array ( [0] => hgjkhgkjhgkjghjkhgkjhgk newline extendedpastthebox----------- )"

    Still contains the ARRAY ([0] => "text" and now it only displays one of the arrays, So this is NOT what i wanted to do. I would like for them to all display within an easy to read table.

  9. I wanted to create a 'news' update feature that an admin could login to the site and add 'news'.

     

    Form for inputing news (very basic)

    <div id="stuff">
    <?php
    include_once("./dbconfig.php");
    $n="";
    echo 
    "<form name='news' action='./processnews.php' method='post' enctype='multipart/form-data'>
    <table cellspacing='16' cellpadding='0' border='0'  >
    <tr>
    	<td class='form_field' valign='top' align='right'>Avalibility of this News </td><td width='10'  aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td>
    
    	<td class='form_text'>
    <input type='radio' name='Avalib'  value='1'   > Availible to Administration ONLY<br>
    <input type='radio' name='Avalib'  value='2'   > Availible to Members and Administration<br>
    <input type='radio' name='Avalib'  value='3'   > Availible to Everyone<br>
    
    	</td>
    </tr>
    <tr>
    	<td class='form_field' valign='top' align='right'>Date </td><td width='10'  aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td>
    	<td class='form_text'>
    <textarea name='Date' rows=1 cols=25 ></textarea>
    
    	</td>
    </tr>
    
    <tr>
    	<td class='form_field' valign='top' align='right'>News </td><td width='10'  aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td>
    	<td class='form_text'>
    <textarea name='News' rows=4 cols=25 ></textarea>
    
    	</td>
    </tr>
    
    
    <tr><td colspan=3 align='center'><input type='submit' value='Submit'>    <input type='reset' value='Reset'></td></tr>
    </table>
    </form>
    ";
    ?>
    </div>

     

    This code posts data from form above.

    <?php 
    session_start();
    if(isset($_SESSION['admin_user'])){
    $tmp=$_SESSION['admin_user'];	
    
    $var0 = $_POST['Avalib'];
    $var1 = stripslashes($_POST['News']);
    //	$var2 = stripslashes($_POST['userid']);
    $var3 = $_POST['Date'];
    include("./dbconfig.php");
    $sql = mysql_query("SELECT id FROM admin WHERE nickname = '$tmp'") or die(mysql_error());
    //echo "$tmp,$var0,$var1";
    $num = mysql_fetch_array($sql);
    	include_once('./includes/adminhead.inc');
    	include_once('./includes/adminlogo.inc');
    	include_once('./includes/adminmenu.inc'); 	
    	$result = mysql_query("INSERT INTO news(adminid, news, viewership, date) VALUES('$num[0]', '$var1', '$var0', '$var3')");
    	print "** Thank you <B><font color=#adfcff>";
    	print $tmp;
    	print "</B></font> your news has been registered. **";
    include_once('./includes/membernews.inc');
    include_once('./includes/adminfooter.inc');      
    } else {
    header('Location:admin.php?notloggedin=1');
    }
    ?>

     

    This is SUPPOSED TO retrieve my news and uses sessions to decide if the user is an admin/regular user/or not logged in

    the viewership field determins what user can see what data.. ALL OF THAT IS IRRELEVANT.. the code works.. kinda

    <?php
    include_once("./dbconfig.php");
    if (isset($_SESSION['admin_user'])){
    $tmp=$_SESSION['admin_user'];
    $adminq="SELECT news FROM news WHERE viewership > 0";
    $adminsql=mysql_query($adminq);	
    //$adminrow=mysql_fetch_assoc($adminsql);
    //echo "$adminsql";
    $i=0;
    while($row = mysql_fetch_assoc($adminsql)){
    			foreach($row as $key => $value){
    				$data[$i][$key] = $value;
    			}
    			$i++;
    		}
    		print_r($data);
    //==================================================================	
    } elseif (isset($_SESSION['ses_user'])){
    			$tmp=$_SESSION['ses_user'];
    //==================================================================
    		} else {
    
    		}
    ?>
    </div>

     

    HERE IS THE OUTPUT I GET

    =================================================

    Array ( [0] => Array ( [news] => hgjkhgkjhgkjghjkhgkjhgk newline extendedpastthebox----------- ) [1] => Array ( [news] => News and Events from today ) [2] => Array ( [news] => Ipsum Lorium ) [3] => Array ( [news] => big news and its important ) [4] => Array ( [news] => big news and its important ) )

    =================================================

     

    How can i take the above information and remove the tags and crap from it so that it can be formatted and readable within a table???

  10. Thank you very much! I think that i have most of your queries up and working on my site! I just have one last question when i use your query i get a result like this

    Array ( [0] => Array ( [example] => hgjkhgkjhgkjghjkhgkjhgk

    as my print out.. how can i grab just the information and put it into a nice looking table?

    I have seen some "while looping" tables before.. but i don't really understand how to format the results to make a readable table.

    Thank you again very much! This forum is a great asset! I really appreciate what you guys do here.

  11. ok i understand  what your saying about restructuring the tables in that fashion..  and it makes since but i would have to rewrite my pickregistration process.. and im a novice so once again it would require some sort of while statement.. i am able to read your code and understand what you are doing but... i don't know how to "think about it" the way you do to come up with how it should work? i guess that comes with practice?? here is my current pick registration system

     

    1st page is a Form with game names and team names and radio buttons.. the user just selects the teams corresponding radio button

    2nd page is the actual processing of the forum (displayed below)

    <?php session_start();
    if(isset($_SESSION['ses_user'])){
    $tmp=$_SESSION['ses_user'];	
    
    $var1 = $_POST['game1'];
    $var2 = $_POST['game2'];
    $var3 = $_POST['game3'];
    $var4 = $_POST['game4'];
    $var4 = $_POST['game4'];
    $var5 = $_POST['game5'];
    $var6 = $_POST['game6'];
    $var7 = $_POST['game7'];
    $var8 = $_POST['game8'];
    $var9 = $_POST['game9'];
    $var10 = $_POST['game10'];
    $var11 = $_POST['game11'];
    $var12 = $_POST['game12'];
    $var13 = $_POST['game13'];
    $var14 = $_POST['game14'];
    $var15 = $_POST['game15'];
    $var16 = $_POST['game16'];
    $var17 = $_POST['game17'];
    $var18 = $_POST['game18'];
    $var19 = $_POST['game19'];
    $var20 = $_POST['game20'];
    $var21 = $_POST['game21'];
    $var22 = $_POST['game22'];
    $var23 = $_POST['game23'];
    $var24 = $_POST['game24'];
    $var25 = $_POST['game25'];
    $var26 = $_POST['game26'];
    $var27 = $_POST['game27'];
    $var28 = $_POST['game28'];
    $var29 = $_POST['game29'];
    $var30 = $_POST['game30'];
    $var31 = $_POST['game31'];
    $var32 = $_POST['game32'];
    $var33 = $_POST['gamepts'];
    $var34 = $_POST['qbyards'];
    
    include_once("./dbconfig.php");
    
    $idresult = mysql_query("SELECT id FROM members WHERE nickname = '$tmp'") or die(mysql_error());
    $id = mysql_fetch_array ($idresult) or die(mysql_error());
    //	echo "$id[0]";
    
    	include_once('./includes/head.inc');
    	include_once('./includes/logo.inc');
    	include_once('./includes/membermenu.inc'); 	
    
    	$result=mysql_query("INSERT INTO picks (id, game1, game2, game3, game4, game5, game6, game7, game8, game9, game10, game11, game12, game13, game14, game15, game16, game17, game18, game19, game20, game21, game22, game23, game24, game25, game26, game27, game28, game29, game30, game31, game32, gamepoints, qbpassyards) VALUES('$id[0]', '$var1', '$var2', '$var3', '$var4','$var5','$var6','$var7','$var8','$var9','$var10','$var11','$var12','$var13','$var14','$var15','$var16','$var17','$var18','$var19','$var20','$var21','$var22','$var23','$var24','$var25','$var26','$var27','$var28','$var29','$var30','$var31','$var32','$var33','$var34')") or die("<font size='3' color='red'><b>ERROR:</b>Please check to make sure that you have selected a team  from <b>EVERY</b> game, and that you have filled in the <b>TIEBREAKERS</b>.</font>");
    // echo "$result";
    	$addpicks=mysql_query("UPDATE members SET picks = 1 WHERE id = '$id[0]'") or die(mysql_error());
    	print "** Thank you <B><font color=#adfcff>";
    	print $tmp;
    	print "</B></font> for registering your picks. **";
    
    include_once('./includes/memberpicksbody.inc');
    include_once('./includes/footer.inc');      
    } else {
    header("Location:index.php?notloggedin=1");
    }
    ?>

    The session as you can see from the code is the user name which i use to find the user ID. As you may have notcied in my tables pick.id=user.id. I am going to change my tables to the resemble the ones you have shown above. Given that how should i restructure my code to fit your new table design? Thank you very much

  12. Ok.. I cannot even wrap my head around how to accomplish this task.. im a novice can anyone help me? I know i need to produce a loop but I have no idea how to do that given my circumstances. (this code is for a football pool website)

    HERE IS WHAT I WANT TO ACCOMPLISH

    • the users PICKS table must be compared with the WINNERS table (the winners table should have higher precedence)
    • using the comparison between PICKS and WINNERS generate a table with the # of correct picks
    • the list should display user name and sort the list by the highest # of correct picks
    • i also need to generate a link after the # of correct items and it will display all of the picks made by that user

     

    MEMBERS TABLE
    CREATE TABLE `members` (                                 
               `id` int(4) NOT NULL auto_increment,                   
               `nickname` varchar(30) NOT NULL default '',            
               `password` varchar(30) NOT NULL default '',            
               `email` varchar(30) default '',                        
               `name` varchar(30) default '',                         
               `payment` int(1) default '0',                          
               `picks` int(1) default '0',                            
               PRIMARY KEY  (`id`),                                   
               UNIQUE KEY `nickname` (`nickname`)                     
             ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1  
    

    PICKS TABLE
    picks   CREATE TABLE `picks` (                                                                  
              `id` int(4) NOT NULL default '0',                                                     
              `Game1` int(1) default NULL,                                                          
              `Game2` int(1) default NULL,                                                          
              `Game3` int(1) default NULL,                                                          
              `Game4` int(1) default NULL,                                                          
              `Game5` int(1) default NULL,                                                          
              `Game6` int(1) default NULL,                                                          
              `Game7` int(1) default NULL,                                                          
              `Game8` int(1) default NULL,                                                          
              `Game9` int(1) default NULL,                                                          
              `Game10` int(1) default NULL,                                                         
              `Game11` int(1) default NULL,                                                         
              `Game12` int(1) default NULL,                                                         
              `Game13` int(1) default NULL,                                                         
              `Game14` int(1) default NULL,                                                         
              `Game15` int(1) default NULL,                                                         
              `Game16` int(1) default NULL,                                                         
              `Game17` int(1) default NULL,                                                         
              `Game18` int(1) default NULL,                                                         
              `Game19` int(1) default NULL,                                                         
              `Game20` int(1) default NULL,                                                         
              `Game21` int(1) default NULL,                                                         
              `Game22` int(1) default NULL,                                                         
              `Game23` int(1) default NULL,                                                         
              `Game24` int(1) default NULL,                                                         
              `Game25` int(1) default NULL,                                                         
              `Game26` int(1) default NULL,                                                         
              `Game27` int(1) default NULL,                                                         
              `Game28` int(1) default NULL,                                                         
              `Game29` int(1) default NULL,                                                         
              `Game30` int(1) default NULL,                                                         
              `Game31` int(1) default NULL,                                                         
              `Game32` int(1) default NULL,                                                         
              `gamepoints` int(3) default NULL,                                                     
              `qbpassyards` int(3) default NULL,                                                    
              PRIMARY KEY  (`id`)                                                                   
            ) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC  
    

     

    Once a user makes a PICKS for a game it is stored in the database as "1" for the FAVORITE team and "2" for the UNDERDOG

    the WINNER table is identical to the PICKS table except it has no id field.. the winner table will have the winning teams number in it.. everyone of the user's PICKS that are the same as the WINNER table numbers should add up and produce a total # of correct answers

    i hope this makes since.. thanks for any advice or help in advance

  13. I think it would be more along the lines

     

    UPDATE $tbl_members SET payment = 1 WHERE nickname = '$tmp';

     

    Great! Thanks! The initial problem is solved now! Sorry I forgot to mention that the file that i am showing is an include.. every $variable is defined somewhere! Thank you for the quick help..

     

    New problem.. Now I am getting greedy!

    I would like for the page to assess if the user has made a payment. If they have gone through the paypal payment process the page should change their database entry to a "1".. once the admin has verified the payment has been received he will change the users payment value to "2" ill cover the admin function on another page.. but now i am having an issue getting the page to check for the payment value? i think im going this right but my page is turning up completely blank.. my assumption is that my problem is somewhere withing the IF syntax.. but i am not familiar with it enough to know whats wrong.. thank you! in advance

     

    <?php
    include_once("./dbconfig.php");
    //echo "$tmp";
    //---------------------HERE IS MY NEW PROBLEM-----------------------------------------
    $paid = mysql_query("SELECT * FROM members WHERE nickname ='$tmp' AND payment = '2'");
    $paidrows = mysql_num_rows($paid);
    if ($paidrows==1){
    echo "Your Payment Has Allready Been Accepted Thank You!";
    echo "$paidrows";
    }
    $paid2 = mysql_query("SELECT * FROM members WHERE nickname ='$tmp' AND payment = '1'");
    $paidrows2 = mysql_num_rows($paid2);
    if ($paidrows2==1){
    echo "Your payment is being processed. Please check back to make sure that it clears!";
    }
    //--------------------------------------------------------------
    if ($paid=0){ 
    if ($_GET['payed'] == 1){
    			echo '<font color=red>Payment being processed. Thank you! Goodluck! </font><p>';
    	$result = mysql_query("SELECT id FROM members WHERE nickname = '$tmp'");
    	$num=mysql_num_rows($result);
    	//echo "$result";
    	if ($num >0){
    	$insert = mysql_query("UPDATE $tbl_members SET payment = 1 WHERE nickname = '$tmp'");
    	//echo "$insert";
    	}else {
    		echo "An error has occured. My coding has a flaw in it.";
    	}			
    
    } else {
    echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="xxxxxx@gmail.com">
    <input type="hidden" name="item_name" value="Subscription to xxxxxxxxxxxxx">
    <input type="hidden" name="amount" value="8.00">
    <input type="hidden" name="shipping" value="0.00">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="return" value="http://localhost/xxxxxx/payment.php?payed=1">
    <input type="hidden" name="cancel_return" value="http://localhost/xxxxxx/payment.php?=canceled1">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="tax" value="0.00">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="bn" value="PP-BuyNowBF">
    <input type="image" src="./css/images/paybutton.png" border="0" name="submit" alt="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif">
    <img alt="Image Failed to load" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form>';}}
    ?>

  14. ok *disclaimer* I am literally reading "php bible" and trying to teach myself php.. i have no friends who know php and its the first real "language" im learning (html doesnt count im sure).. so please don't assume i know ANYTHING im 99% sure i won't.. thanks

    i did a search but i don't know what would be a good string to get the results that would give me my answer hope this hasn't been covered before!

     

    Here is my problem

    1) i need a mysql_query to pull an user ID out of a table using a USER NAME

    2) once i have the user ID i need to change an already existing value in that row

     

    Notes about my site

    • When a user logs into the site that i have made i use their username as their session id.. so i can pull that up from any where (is this a good idea? or are there security issues with this? im not using cookies and im not _POSTing anything.)
       
    • i am familiar with includes so don't worry i have all of the connections to the database and ect... working

     

    My code SO FAR  $tmp = _session id = user's nickname when they login

    <?php
    include_once("./dbconfig.php");
    //echo "$tmp";
    $result = mysql_query("SELECT id FROM members WHERE nickname = '$tmp'");
    $num=mysql_num_rows($result);
    //echo "$result";
    	if ($num >0){
    $insert = mysql_query("INSERT INTO $tbl_members WHERE nickname = '$tmp' (payment) VALUE('1')");
    // NO IDEA WHAT THIS QUERY SHOULD BE TO MODIFY THE PAYMENT FIELDS VALUE
    echo "$insert";
    	}else {
    		echo "An error has occured.  My coding has a flaw in it.";
    	}
    ?>

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