Jump to content

soccerrprp1

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Posts posted by soccerrprp1

  1. hi shlumph,

     

    well, i want to create multiple versions of the same php file. so, want to be able to post input to all of these and the various versions are being used by others in different ways. kind of having 3 or 4 different styles of the same php file.

     

    how would i go about doing this?

     

    thanks.

  2. I only see an insert query, if you wish to display data to users that didn't post the data you must select it from the database using a select query, then feth the data using a mysql_fetch function (such as mysql_fetch_row then display the fetched data accordingly. Once the page is refreshed, unless the browser is re-posting the data to php (probably the case), the values will disappear to the poster aswell as they haven't been posted...

     

    thanks Andy-H! Got it working! now issue of formatting to take care of  ::)

  3. thanks andy,

     

    here is my php as is. the html page where data is entered and posted to db is as above:

     

    <?php # BEGINNING OF PHP!

     

    $gsteam= $_POST["gsteam"];

    $gsteam1= $_POST["gsteam1"];

    $gsstatus= $_POST["gsstatus"];

    $gsscore= $_POST["gsscore"];

    $gsscore1= $_POST["gsscore1"];

     

    $bteam= $_POST["bteam"];

    $bteam1= $_POST["bteam1"];

    $bstatus= $_POST["bstatus"];

    $bscore= $_POST["bscore"];

    $bscore1= $_POST["bscore1"];

     

    $s1team= $_POST["s1team"];

    $s1team1= $_POST["s1team1"];

    $s1status= $_POST["s1status"];

    $s1score= $_POST["s1score"];

    $s1score1= $_POST["s1score1"];

     

    $s2team= $_POST["s2team"];

    $s2team1= $_POST["s2team1"];

    $s2status= $_POST["s2status"];

    $s2score= $_POST["s2score"];

    $s2score1= $_POST["s2score1"];

     

    $gteam= $_POST["gteam"];

    $gteam1= $_POST["gteam1"];

    $gstatus= $_POST["gstatus"];

    $gscore= $_POST["gscore"];

    $gscore1= $_POST["gscore1"];

     

    //$username = "littleti";

    //$password = "password";

    //$hostname = "localhost";

     

    //connection to the database

    $dbhandle = mysql_connect("localhost","littleti_user","user")

    or die("Unable to connect to MySQL" .mysql_error());

    echo "Connected to MySQL<br>";

     

    //select a database to work with

    $selected = mysql_select_db("littleti_droid",$dbhandle)

      or die("Could not select examples" .mysql_error());

     

     

    //insert data from php web page

     

    $query="INSERT INTO stats (gsteam, gsteam1, gsstatus, gsscore, gsscore1, bteam, bteam1, bstatus, bscore, bscore1, s1team, s1team1, s1status, s1score, s1score1, s2team, s2team1, s2status, s2score, s2score1, gteam, gteam1, gstatus, gscore, gscore1) VALUES ('".$gsteam."','".$gsteam1."','".$gsstatus."','".$gsscore."','".$gsscore1."','".$bteam."','".$bteam1."','".$bstatus."','".$bscore."','".$bscore1."','".$s1team."','".$s1team1."','".$s1status."','".$s1score."','".$s1score1."','".$s2team."','".$s2team1."','".$s2status."','".$s2score."','".$s2score1."','".$gteam."','".$gteam1."','".$gstatus."','".$gscore."','".$gscore1."')";

     

    $result = mysql_query($query) or die(mysql_error());

     

    //fetch tha data from the database 

     

    echo "[V]Team: " .$gsteam."  ".$gsscore."                              Status: ".$gsstatus. "<br>";// input from web based

    echo "[H]Team: " .$gsteam1."  ".$gsscore1."<br><br>";// input from web based

     

    echo "[V]Team: " .$bteam."  ".$bscore."                              Status: ".$bstatus. "<br>";// input from web based

    echo "[H]Team: " .$bteam1."  ".$bscore1."<br><br>";// input from web based

     

    echo "[V]Team: " .$s1team."  ".$s1score."                              Status: ".$s1status. "<br>";// input from web based

    echo "[H]Team: " .$s1team1."  ".$s1score1."<br><br>";// input from web based

     

    echo "[V]Team: " .$s2team."  ".$s2score."                              Status: ".$s2status. "<br>";// input from web based

    echo "[H]Team: " .$s2team1."  ".$s2score1."<br><br>";// input from web based

     

    echo "[V]Team: " .$gteam."  ".$gscore."                              Status: ".$gstatus. "<br>";// input from web based

    echo "[H]Team: " .$gteam1."  ".$gscore1."<br><br>";// input from web based

     

     

    //close the connection

    mysql_close($dbhandle);

    ?>

  4. ah, got you. sorry. in the actual php file, that is not an issue.

     

    <?php # BEGINNING OF PHP!

     

    $gsteam= $_POST["gsteam"];

    $gsteam1= $_POST["gsteam1"];

    $gsstatus= $_POST["gsstatus"];

    $gsscore= $_POST["gsscore"];

    $gsscore1= $_POST["gsscore1"];

     

    $bteam= $_POST["bteam"];

    $bteam1= $_POST["bteam1"];

    $bstatus= $_POST["bstatus"];

    $bscore= $_POST["bscore"];

    $bscore1= $_POST["bscore1"];

     

    $s1team= $_POST["s1team"];

    $s1team1= $_POST["s1team1"];

    $s1status= $_POST["s1status"];

    $s1score= $_POST["s1score"];

    $s1score1= $_POST["s1score1"];

     

    $s2team= $_POST["s2team"];

    $s2team1= $_POST["s2team1"];

    $s2status= $_POST["s2status"];

    $s2score= $_POST["s2score"];

    $s2score1= $_POST["s2score1"];

     

    $gteam= $_POST["gteam"];

    $gteam1= $_POST["gteam1"];

    $gstatus= $_POST["gstatus"];

    $gscore= $_POST["gscore"];

    $gscore1= $_POST["gscore1"];

     

    $username = "something";

    $password = "something";

    $hostname = "localhost";

     

    //connection to the database

    $dbhandle = mysql_connect($hostname, $username, $password)

    or die("Unable to connect to MySQL" .mysql_error());

    echo "Connected to MySQL<br>";

     

    //select a database to work with

    $selected = mysql_select_db("littleti_droid",$dbhandle)

      or die("Could not select examples" .mysql_error());

     

     

    //insert data from php web page

     

    $query="INSERT INTO stats (gsteam, gsteam1, gsstatus, gsscore, gsscore1, bteam, bteam1, bstatus, bscore, bscore1, s1team, s1team1, s1status, s1score, s1score1, s2team, s2team1, s2status, s2score, s2score1, gteam, gteam1, gstatus, gscore, gscore1) VALUES ('".$gsteam."','".$gsteam1."','".$gsstatus."','".$gsscore."','".$gsscore1."','".$bteam."','".$bteam1."','".$bstatus."','".$bscore."','".$bscore1."','".$s1team."','".$s1team1."','".$s1status."','".$s1score."','".$s1score1."','".$s2team."','".$s2team1."','".$s2status."','".$s2score."','".$s2score1."','".$gteam."','".$gteam1."','".$gstatus."','".$gscore."','".$gscore1."')";

     

    $result = mysql_query($query) or die(mysql_error());

     

    //fetch tha data from the database 

     

    echo "[V]Team: " .$gsteam."  ".$gsscore."                              Status: ".$gsstatus. "<br>";// input from web based

    echo "[H]Team: " .$gsteam1."  ".$gsscore1."<br><br>";// input from web based

     

    echo "[V]Team: " .$bteam."  ".$bscore."                              Status: ".$bstatus. "<br>";// input from web based

    echo "[H]Team: " .$bteam1."  ".$bscore1."<br><br>";// input from web based

     

    echo "[V]Team: " .$s1team."  ".$s1score."                              Status: ".$s1status. "<br>";// input from web based

    echo "[H]Team: " .$s1team1."  ".$s1score1."<br><br>";// input from web based

     

    echo "[V]Team: " .$s2team."  ".$s2score."                              Status: ".$s2status. "<br>";// input from web based

    echo "[H]Team: " .$s2team1."  ".$s2score1."<br><br>";// input from web based

     

    echo "[V]Team: " .$gteam."  ".$gscore."                              Status: ".$gstatus. "<br>";// input from web based

    echo "[H]Team: " .$gteam1."  ".$gscore1."<br><br>";// input from web based

     

     

    //close the connection

    mysql_close($dbhandle);

    ?>

  5. Thanks for the reply, but the hostname, password, host have all been set to their respective values so that the database can be accessed. So, how is hostname extraneous? Isn't it needed to access the db? The original code at top is misleading because the actual php file has the values.

     

    I can clearly access the db and the php returns updated with new data, but why it doesn't update other instances of the php file is beyond me.

  6. hey guys, thanks

     

    refreshing page does not update data. ajax is my next step and pretty certain i'll be able to get what i need from it.

     

    i have my code below.

     

    here is my code for php:

     

     

    <?php # BEGINNING OF PHP!
    
    $gsteam= $_POST["gsteam"];
    $gsteam1= $_POST["gsteam1"];
    $gsstatus= $_POST["gsstatus"];
    $gsscore= $_POST["gsscore"];
    $gsscore1= $_POST["gsscore1"];
    
    $bteam= $_POST["bteam"];
    $bteam1= $_POST["bteam1"];
    $bstatus= $_POST["bstatus"];
    $bscore= $_POST["bscore"];
    $bscore1= $_POST["bscore1"];
    
    $s1team= $_POST["s1team"];
    $s1team1= $_POST["s1team1"];
    $s1status= $_POST["s1status"];
    $s1score= $_POST["s1score"];
    $s1score1= $_POST["s1score1"];
    
    $s2team= $_POST["s2team"];
    $s2team1= $_POST["s2team1"];
    $s2status= $_POST["s2status"];
    $s2score= $_POST["s2score"];
    $s2score1= $_POST["s2score1"];
    
    $gteam= $_POST["gteam"];
    $gteam1= $_POST["gteam1"];
    $gstatus= $_POST["gstatus"];
    $gscore= $_POST["gscore"];
    $gscore1= $_POST["gscore1"];
    
    $username = ""hostname";
    $password = "username";
    $hostname = "localhost"; 
    
    //connection to the database
    $dbhandle = mysql_connect($hostname, $username, $password) 
    or die("Unable to connect to MySQL" .mysql_error());
    echo "Connected to MySQL<br>";
    
    //select a database to work with
    $selected = mysql_select_db("littleti_droid",$dbhandle) 
      or die("Could not select examples" .mysql_error());
      
       
    //insert data from php web page
    
    $query="INSERT INTO stats (gsteam, gsteam1, gsstatus, gsscore, gsscore1, bteam, bteam1, bstatus, bscore, bscore1, s1team, s1team1, s1status, s1score, s1score1, s2team, s2team1, s2status, s2score, s2score1, gteam, gteam1, gstatus, gscore, gscore1) VALUES ('".$gsteam."','".$gsteam1."','".$gsstatus."','".$gsscore."','".$gsscore1."','".$bteam."','".$bteam1."','".$bstatus."','".$bscore."','".$bscore1."','".$s1team."','".$s1team1."','".$s1status."','".$s1score."','".$s1score1."','".$s2team."','".$s2team1."','".$s2status."','".$s2score."','".$s2score1."','".$gteam."','".$gteam1."','".$gstatus."','".$gscore."','".$gscore1."')";
    
    $result = mysql_query($query) or die(mysql_error());
    
    //fetch tha data from the database  
    
    echo "[V]Team: " .$gsteam."  ".$gsscore."                              Status: ".$gsstatus. "<br>";// input from web based
    echo "[H]Team: " .$gsteam1."  ".$gsscore1."<br><br>";// input from web based
    
    echo "[V]Team: " .$bteam."  ".$bscore."                              Status: ".$bstatus. "<br>";// input from web based
    echo "[H]Team: " .$bteam1."  ".$bscore1."<br><br>";// input from web based
    
    echo "[V]Team: " .$s1team."  ".$s1score."                              Status: ".$s1status. "<br>";// input from web based
    echo "[H]Team: " .$s1team1."  ".$s1score1."<br><br>";// input from web based
    
    echo "[V]Team: " .$s2team."  ".$s2score."                              Status: ".$s2status. "<br>";// input from web based
    echo "[H]Team: " .$s2team1."  ".$s2score1."<br><br>";// input from web based
    
    echo "[V]Team: " .$gteam."  ".$gscore."                              Status: ".$gstatus. "<br>";// input from web based
    echo "[H]Team: " .$gteam1."  ".$gscore1."<br><br>";// input from web based
    
    
    //close the connection
    mysql_close($dbhandle);
    ?>
    

     

    here is my data entry code:

     

     

    <body> 
    
    <form method="post" action="update.php"> 
    <!--Gloria H. Snyder Stadium --> 
    <b>Gloria H. Snyder Stadium</b> 
    <br/> 
    V:
    <input type="text" name="gsteam" size="30" />  
    <input type="text" name="gsscore" size="2" /> 
    Status:
    <input type="text" name="gsstatus" size="10" /> 
    <br/> 
    H:
    <input type="text" name="gsteam1" size="30" /> 
    <input type="text" name="gsscore1" size="2" /> 
    <input type="submit" value="Update Database" /> 
    
    </form> 
    
    <form method="post" action="update.php"> 
    <!--Baseball Stadium --> 
    <b>Baseball Stadium</b> 
    <br/> 
    
    V:
    <input type="text" name="bteam" size="30" />  
    <input type="text" name="bscore" size="2" /> 
    Status:
    <input type="text" name="bstatus" size="10" /> 
    <br/> 
    H:
    <input type="text" name="bteam1" size="30" /> 
    <input type="text" name="bscore1" size="2" /> 
    <input type="submit" value="Update Database" /> 
    </form> 
    
    <form method="post" action="update.php"> 
    <!--Softball 1 --> 
    <b>Softball Field I</b> 
    <br/> 
    
    V:
    <input type="text" name="s1team" size="30" />  
    <input type="text" name="s1score" size="2" /> 
    Status:
    <input type="text" name="s1status" size="10" /> 
    <br/> 
    H:
    <input type="text" name="s1team1" size="30" /> 
    <input type="text" name="s1score1" size="2" /> 
    <input type="submit" value="Update Database" /> 
    </form> 
    
    <form method="post" action="update.php"> 
    <!--Softball 2 --> 
    <b>Softball Field II</b> 
    <br/> 
    
    V:
    <input type="text" name="s2team" size="30" />  
    <input type="text" name="s2score" size="2" /> 
    Status:
    <input type="text" name="s2status" size="10" /> 
    <br/> 
    H:
    <input type="text" name="s2team1" size="30" /> 
    <input type="text" name="s2score1" size="2" /> 
    <input type="submit" value="Update Database" /> 
    </form> 
    
    <form method="post" action="update.php"> 
    <!--Gymnasium --> 
    <b>Gymnasium</b> 
    <br/> 
    
    V:
    <input type="text" name="gteam" size="30" />  
    <input type="text" name="gscore" size="2" /> 
    Status:
    <input type="text" name="gstatus" size="10" /> 
    <br/> 
    H:
    <input type="text" name="gteam1" size="30" /> 
    <input type="text" name="gscore1" size="2" /> 
    <input type="submit" value="Update Database" /> 
    
    </form> 
    
    </body> 
    
    

     

     

    MOD EDIT:

     . . . 

    tags added. ~P2k

  7. Hi all,

     

    I've created a data-entry HTML page that posts to update.php. I am using mysql to store the data entered. When I enter data and hit "update database" button, the php file pops up and correctly shows the data entered, but the update.php file does not show that same data on another computer. I have checked the mysql database and it clearly shows that it the new data has been stored. Why isn't the data showing up on any other computer?

     

    I can provide codes as needed.

     

    Thanks.

     

    Richard

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