Jump to content

phppup

Members
  • Posts

    837
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by phppup

  1. Does time zone change have to occur in an INI file, or can I place it as a value.

     

    I've tried using default_time_zone ('America/New York') but had no success with it, even to just ECHO a statement that says: It is now 3:50PM in New York.

  2. Along the same lines as a "Thank you for you submission" message, is there a simple way to echo the CHANGES made to a record AFTER it has been UPDATED.

     

    For example: You have added 2 skirts and 1 shirt to your order

    OR      You're order has been reduced by 2 pair of socks.

     

    This would compare what was stored with the change.

     

    Alternately, is there a way to show a message that ONLY addresses the values that have CHANGED as a result of the UPDATE.

    Example:  You have altered the quantity of the following items: dresses, hats, gloves.

     

  3. WOW!  found the same line of code in my UPDATE script.  Took it out and I'm working fine now.

     

    Thanks a TON! 

     

    (i think i'll quit while ahead... LOL)

     

    So what EXACTLY is that line saying?

     

    And is it necessary in one way or another as a double-check process of the form?

  4. It worked prviously with it (i think!), but i took it out and it seems to have repaired the problem.

     

    So what EXACTLY is that line saying?

     

    And is it necessary in one way or another as a double-check process of the form?

  5. CONNECT

    if(isset($_POST['action']) && $_POST['action'] == 'submitform')

    {

    $roastturkey = $_POST['roastturkey'];

    $broccoli = $_POST['broccoli'];

    $brisket = $_POST['brisket'];

    $carrots = $_POST['carrots'];

    }

     

    $sql = "INSERT INTO pass (roastturkey,broccoli,brisket,carrots) VALUES ('$roastturkey','$broccoli','$brisket','$carrots')";

     

    $result=mysql_query($sql);

     

    if($result){

    echo "Successful";

    }else {

    echo "ERROR";

    }

     

    Fairly simple, I think, and it used to work.

     

    ** Disclaimer: Not responsible if this code causes hunger or urges to snack **

  6. I will start posting code if I have to, but first, the only "adjustment" made to the actual database was that I may have added to columns (at various locations between others) and then I later deleted them. 

    I have since replaced them as a troubleshooting technique, but their NAMES are NOT receiving any values (which is why I removed them in the first place).

     

    Does this sort of manuever affect the tables?? 

     

    (I'm a newbie, so maybe I just messed it up... LOL)

  7. My database was working fine (for test purposes) a week ago.  Now, it will not record data input from my forms.

    If I add a new record, it adds the record, but none of the data.

    If I update a record, it erases the values.

     

    The forms and attached scripts have NOT undergone any changes, and they DO provide SUCCESS messages.

     

    Ideas?

  8. I may be on my way to a solution.

    Question: If the code below will scan ALL fields of my form, how can I add to the code to eliminate just one or two of the inputs, while leaving the remaining 30?

     

    $myUpdateList = array();foreach($_POST as $indexName => $value) {    $myUpdateList[] = "$indexName = \"$value

  9. It did NOT work.

     

    I commented OUT these lines, and hardcoded the third, and DID get a SUCCESS message:

     

    #$pass = array();foreach($_POST as $indexName => $value) {    $pass[] = "$indexName = \"$value\"";}

    #$fields = implode(",", $pass);

    $sql=("UPDATE pass SET carrots ='6' WHERE id = '5' ");

     

    So now what??

     

  10. Evidently you're assuming that I understand certain things that i do NOT know, and I'm making the same mistake with you.  I am trying to save a little room in the thread, but apparently that is backfiring too.

     

    Page 1 is a dropdown that sorts the ID's to become $record_id (code on previous page)

    works fine.

     

    Page 2 displays the form with inputs that can be changed (also displays okay)

    CONNECT

     $record_id = (isset($_POST['record_id'])) ? $_POST['record_id'] : '';
    if(!empty($record_id))
    {
    
    $result = mysql_query("SELECT * FROM pass WHERE id = $record_id ")
    or die(mysql_error());
    
    $row = mysql_fetch_array( $result );
    
    echo "<FORM name='orderpage' action='myupdatepage.php' method='post'>";
    
    echo "<tr><td>"; 
    echo "<select name='roastturkey'>";
    echo        "<option value='0.00'  " . ($row['roastturkey'] == 0.00 ? 'selected="selected"' : '') . ">0</option>";
    echo        "<option value='1.00'  " . ($row['roastturkey'] == 1.00 ? 'selected="selected"' : '') . ">1</option>";
    echo        "<option value='2.00' " . ($row['roastturkey'] == 2.00 ? 'selected="selected"' : '') . ">2</option>";
    echo        "<option value='3.00' " . ($row['roastturkey'] == 3.00 ? 'selected="selected"' : '') . ">3</option>";
    echo        "<option value='4.00' " . ($row['roastturkey'] == 4.00 ? 'selected="selected"' : '') . ">4</option>";
    echo        "<option value='5.00' " . ($row['roastturkey'] == 5.00 ? 'selected="selected"' : '') . ">5</option>";
    echo        "<option value='6.00' " . ($row['roastturkey'] == 6.00 ? 'selected="selected"' : '') . ">6</option>";
    echo        "<option value='7.00' " . ($row['roastturkey'] == 7.00 ? 'selected="selected"' : '') . ">7</option>";
    echo        "<option value='8.00' " . ($row['roastturkey'] == 8.00 ? 'selected="selected"' : '') . ">8</option>";
    echo        "<option value='9.00' " . ($row['roastturkey'] == 9.00 ? 'selected="selected"' : '') . ">9</option>";
    echo        "<option value='10.00'  " . ($row['roastturkey'] == 10.00 ? 'selected="selected"' : '') . ">10</option>";
    echo        "      </select></td><td rowspan='2'>ROAST TURKEY</span></td><td rowspan='2'>7.00 LB</span></td> ";
    echo        "                           <td rowspan='2'>ujiujjpooj</span></td><td rowspan='2'> <!-- FILLER --> </span></td>";
    echo        "       <td> <!-- BLANK CELL --> </td><td>STEAMED VEGETABLES</td><td>16.00 LB</td><td>ujiujjpooj</td>";
    
    echo "</tr>"; 
    echo "<tr><td>  <!-- FILLER  for SPAN--> </td>";
    echo "      <td>";
    echo "      <select name='broccoli'>";
    echo        "<option value='0.00'  " . ($row['broccoli'] == 0.00 ? 'selected="selected"' : '') . ">0</option>";
    echo        "<option value='1.00'  " . ($row['broccoli'] == 1.00 ? 'selected="selected"' : '') . ">1</option>";
    echo        "<option value='2.00' " . ($row['broccoli'] == 2.00 ? 'selected="selected"' : '') . ">2</option>";
    echo        "<option value='3.00' " . ($row['broccoli'] == 3.00 ? 'selected="selected"' : '') . ">3</option>";
    echo        "<option value='4.00' " . ($row['broccoli'] == 4.00 ? 'selected="selected"' : '') . ">4</option>";
    echo        "<option value='5.00' " . ($row['broccoli'] == 5.00 ? 'selected="selected"' : '') . ">5</option>";
    echo        "<option value='6.00' " . ($row['broccoli'] == 6.00 ? 'selected="selected"' : '') . ">6</option>";
    echo        "<option value='7.00' " . ($row['broccoli'] == 7.00 ? 'selected="selected"' : '') . ">7</option>";
    echo        "<option value='8.00' " . ($row['broccoli'] == 8.00 ? 'selected="selected"' : '') . ">8</option>";
    echo        "<option value='9.00' " . ($row['broccoli'] == 9.00 ? 'selected="selected"' : '') . ">9</option>";
    echo        "<option value='10.00'  " . ($row['broccoli'] == 10.00 ? 'selected="selected"' : '') . ">10</option>";
    echo "      </select></td><td>  BROCCOLI</td><td> <!-- NO PRICE HERE --> </td><td>ujiujjpooj</td>";
    
    echo "</tr>"; 
    echo "<tr><td>"; 
    echo "      <select name='brisket'>";
    echo        "<option value='0.00'  " . ($row['brisket'] == 0.00 ? 'selected="selected"' : '') . ">0</option>";
    echo        "<option value='1.00'  " . ($row['brisket'] == 1.00 ? 'selected="selected"' : '') . ">1</option>";
    echo        "<option value='2.00' " . ($row['brisket'] == 2.00 ? 'selected="selected"' : '') . ">2</option>";
    echo        "<option value='3.00' " . ($row['brisket'] == 3.00 ? 'selected="selected"' : '') . ">3</option>";
    echo        "<option value='4.00' " . ($row['brisket'] == 4.00 ? 'selected="selected"' : '') . ">4</option>";
    echo        "<option value='5.00' " . ($row['brisket'] == 5.00 ? 'selected="selected"' : '') . ">5</option>";
    echo        "<option value='6.00' " . ($row['brisket'] == 6.00 ? 'selected="selected"' : '') . ">6</option>";
    echo        "<option value='7.00' " . ($row['brisket'] == 7.00 ? 'selected="selected"' : '') . ">7</option>";
    echo        "<option value='8.00' " . ($row['brisket'] == 8.00 ? 'selected="selected"' : '') . ">8</option>";
    echo        "<option value='9.00' " . ($row['brisket'] == 9.00 ? 'selected="selected"' : '') . ">9</option>";
    echo        "<option value='10.00'  " . ($row['brisket'] == 10.00 ? 'selected="selected"' : '') . ">10</option>";
    echo "      </select></td><td>BRISKET OF BEEF</td><td>32.00 LB</td><td>ujiujjpooj</td><td> <!-- FILLER --> </td>";
    echo "      <td>";
    echo "      <select name='carrots'>";
    echo        "<option value='0.00'  " . ($row['carrots'] == 0.00 ? 'selected="selected"' : '') . ">0</option>";
    echo        "<option value='1.00'  " . ($row['carrots'] == 1.00 ? 'selected="selected"' : '') . ">1</option>";
    echo        "<option value='2.00' " . ($row['carrots'] == 2.00 ? 'selected="selected"' : '') . ">2</option>";
    echo        "<option value='3.00' " . ($row['carrots'] == 3.00 ? 'selected="selected"' : '') . ">3</option>";
    echo        "<option value='4.00' " . ($row['carrots'] == 4.00 ? 'selected="selected"' : '') . ">4</option>";
    echo        "<option value='5.00' " . ($row['carrots'] == 5.00 ? 'selected="selected"' : '') . ">5</option>";
    echo        "<option value='6.00' " . ($row['carrots'] == 6.00 ? 'selected="selected"' : '') . ">6</option>";
    echo        "<option value='7.00' " . ($row['carrots'] == 7.00 ? 'selected="selected"' : '') . ">7</option>";
    echo        "<option value='8.00' " . ($row['carrots'] == 8.00 ? 'selected="selected"' : '') . ">8</option>";
    echo        "<option value='9.00' " . ($row['carrots'] == 9.00 ? 'selected="selected"' : '') . ">9</option>";
    echo        "<option value='10.00'  " . ($row['carrots'] == 10.00 ? 'selected="selected"' : '') . ">10</option>";
    echo "      </select></td><td>CARROTS</td><td> <!-- NO PRICE HERE --> </td><td>ujiujjpooj</td>";
    echo "</tr>"; 
    <td><input type='submit' name='submitpass' value='Submit Order'>

     

     

    Now, if anything is to be UPDATED, the changes would have been made and when submitted to myupdatepage.php I would get a SUCCESS, not ERROR

     

    CONNECT

     

    $roastturkey = $_POST['roastturkey'];
    $broccoli = $_POST['broccoli'];
    $brisket = $_POST['brisket'];
    $carrots = $_POST['carrots'];    
    
    $mytabletest = array();foreach($_POST as $indexName => $value) {     $mytabletest[] = "$indexName = \"$value\"";}
    $fields = implode(",", $mytabletest);
    $sql=("UPDATE mytabletest SET $fields WHERE id = $record_id ");
    
    if($result){
    echo "Successful";
    }
    else {
    echo "ERROR";
    }

     

     

     

    I need to know what to add, and WHERE to place it.

  11. the first page has this code to display the fields:

     

    connect:

    $result = mysql_query("SELECT * FROM pass WHERE id = $record_id ")

    or die(mysql_error());

    $row = mysql_fetch_array( $result );

     

    echo echo echo  submit button

     

     

    the second file that gets called AFTER submission of UPDATES is:

     

     

    if(isset($_POST['action']) && $_POST['action'] == 'submitform')

    { $roastturkey = $_POST['roastturkey'];

    $broccoli = $_POST['broccoli'];

    $brisket = $_POST['brisket'];

    $carrots = $_POST['carrots'];

     

    }

     

    $pass = array();foreach($_POST as $indexName => $value) {    $pass[] = "$indexName = \"$value\"";}

    $fields = implode(",", $pass);

    $sql=("UPDATE pass SET $fields WHERE id = $record_id

    $result=mysql_query($sql); ");

     

    if($result){

    echo "Successful";

     

    else {

    echo "ERROR";

    }

     

     

     

    so where exactly shall i put new code??

     

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