Problem, please help!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have not used this site in a while and have a
problem.  I can't get anything to save to the
database. :(  Not sure what is wrong, need a fix fast
as the site needs to be active in a few days by the
latest so hopefully I can get help in that time.  The
code is a bit messy I know but here goes:

------------
tip.php
------------

<?php

include('cookie.php');
?>


<?php
mysql_connect ("localhost");
mysql_select_db ("tipping");

$qr = mysql_query("SELECT *
FROM `fixture1` LIMIT 0 , 30 ") or exit("Home & Away 
season completed!");

 $row = mysql_fetch_array($qr);
  echo " " .$row['roundname']. "<br><br>";
  echo "<Form Action='tip1.php' METHOD='POST'
enctype='multipart/form-data'>";
  echo "<input name='game1' type='radio'
value='".$row['team1']."'>" .$row['team1']." v "
.$row['team2']." ";
  echo "<input name='game1' type='radio'
value='".$row['team2']."'><br>";
  echo "<input name='game2' type='radio'
value='".$row['team3']."'>" .$row['team3']." v "
.$row['team4']." ";
  echo "<input name='game2' type='radio'
value='".$row['team4']."'><br>";
  echo "<input name='game3' type='radio'
value='".$row['team5']."'>" .$row['team5']." v "
.$row['team6']." ";
  echo "<input name='game3' type='radio'
value='".$row['team6']."'><br>";
  echo "<input name='game4' type='radio'
value='".$row['team7']."'>" .$row['team7']." v "
.$row['team8']." ";
  echo "<input name='game4' type='radio'
value='".$row['team8']."'><br>";
  echo "<input name='game5' type='radio'
value='".$row['team9']."'>" .$row['team9']." v "
.$row['team10']." ";
  echo "<input name='game5' type='radio'
value='".$row['team10']."'><br>";
  echo "<input name='game6' type='radio'
value='".$row['team11']."'>" .$row['team11']." v "
.$row['team12']." ";
  echo "<input name='game6' type='radio'
value='".$row['team12']."'><br>";
  echo "<input name='game7' type='radio'
value='".$row['team13']."'>" .$row['team13']." v "
.$row['team14']." ";
  echo "<input name='game7' type='radio'
value='".$row['team14']."'><br>";
  echo "<input name='game8' type='radio'
value='".$row['team15']."'>" .$row['team15']." v "
.$row['team16']." ";
  echo "<input name='game8' type='radio'
value='".$row['team16']."'><br>";

  echo "<input name='submit' type='submit'
value='submit'></form><br><br>";

  ?>

The above page loads the right values from the
database and a form is in the page that saves to the
next page and meant to update the database.  Out come
below:

------------
tip1.php
------------

<?
    if ($REQUEST_METHOD == "POST") {
            $usr = "tassie_jerry"; 
            $pwd = "s2390lpTAS225"; 
            $db = "tassie_tipping"; 
            $host = "localhost"; 

            $cid = mysql_connect($host,$usr,$pwd);
            mysql_select_db($db);


            // NOTE that form fields automatically
become variables

$sql = "UPDATE round1 SET game1='$game1' ,
game2='$game2' , game3='$game3' , game4='$game4'
, game5='$game5' , game6='$game6' , game7='$game7' ,
game8='$game8' , misc='y'
WHERE username= \"$sidarray[0]\"";


            mysql_query("$sql");
            echo("Your tips have been
saved!<br><br><b>$game1<br>$game2<br>$game3<br>$game4<br>$game5<br>$game6<br>$game7<br>$game8<br>");
    }
    else {echo("An error occoured, please click back
button and try again.");}
?>


Okay it output on the php page fine but won't save to
db, anyone know why?

Thanks!

J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux