SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Ridgefield
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation PHP Newbie: need to add total amount from individual fields

    hello all,

    i'm new at this php and mysql stuff,

    i need to display the total amount from each field i have, (each field may have different words submitted i.e. pub_priv may contain public or private)

    here is my code to submit.

    PHP Code:
    <?php 
    error_reporting
    (E_ALL E_NOTICE);
    $db mysql_connect("localhost","",""); 
    mysql_select_db ("reforumc_email"); 
    $query "INSERT INTO equinoxsurvery(pub_priv, size, scope, position, entrepreneur, more_entrep, percieve, attracted, entrep_approach, met, screens, behave, rewarded, offers, function)
    VALUES('"
    .$_POST['pub_priv']."','".$_POST['size']."','".$_POST['scope']."','".$_POST['position']."','".$_POST['entrepreneur']."','".$_POST['more_entrep']."','".$_POST['percieve']."','".$_POST['attracted']."','".$_POST['entrep_approach']."','".$_POST['met']."','".$_POST['screens']."','".$_POST['behave']."','".$_POST['rewarded']."','".$_POST['offers']."','".$_POST['function']."')"
    $result mysql_query($query); 
    echo 
    "Thank you for taking our survey."?>
    here is my code that displays the results

    PHP Code:
    <?php
    $connection 
    mysql_connect ("localhost","reforumc_eup","test1234");
    if (
    $connection == false){
      echo 
    mysql_errno().": ".mysql_error()."<BR>";
      exit;
    }  

    $query "SELECT * FROM equinoxsurvery";
    $result mysql_db_query ("reforumc_email"$query);

    if (
    $result){
      echo 
    "<table border=1>";
      echo 
    "<tr><td><b>Full Name</b></td><td> <b>Email Address</b></td></tr>";

      
    $numOfRows mysql_num_rows ($result);
      for (
    $i 0$i $numOfRows$i++){
        
    $question1 mysql_result ($result$i"pub_priv");
        
    $question2 mysql_result ($result$i"size");
        
    $question3 mysql_result ($result$i"scope");
        
        echo 
    "<table border=1>";  
        echo 
    "<tr colspan=3><td>$question1</td><td bgcolor=#E8EFF7>$question2</td><td>$question3</td></tr>";
        echo 
    "</table>";
      }

      echo 
    "</table>";
    }
    else{
      echo 
    mysql_errno().": ".mysql_error()."<BR>";
    }

    mysql_close ();

    ?>
    and here are the links to the pages that are submitting them... it's not completely ready. and it's not displaying all the results in the tables, but it's a start
    Please tell me if i've made no sense

    test page
    Last edited by daemoncel; Nov 30, 2004 at 13:17.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •