Jump to content

Data won't update


Mutley

Recommended Posts

I've included an updatable form into a page, when I update it, it goes to another page that inlcudes the file with the script to update the database but it doesn't work.

I *think* it isn't carrying the variable from the form to the script to update, so it can't update anything.

Heres part of my form:
[code]require_once("connection.php");
mysql_select_db("rufc");
if(isset($_GET['team'])){
$team = $_GET['team'];
$result = mysql_query("SELECT team, against, kickoff, meeting, against, side, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, date, DATE_FORMAT(date,'%d-%m-%Y') AS dstamp FROM teamplayers WHERE team=".$team." ") or die (mysql_error());;
while($row = mysql_fetch_array( $result ))
    {
?>
<form action="admin_updateplayerlist.php" method="POST">
<input type="hidden" name="team" value="<?php echo $row['team']; ?>">

...[/code]

Heres my page which includes the script:
[code]<?php

$page_title = "Update Player List";
require_once "includes/header.inc.php";
ob_start();
include("config.php");
if($logged['username'])
{

?>
<!-- News Item Start -->
<?
include("playerlist/update_confirm.php");
?>

<!-- News Item End -->

<?php
}
else
{
echo 'You do not have permission to access this page, your activity/IP has been logged.';
}
require_once "includes/footer.inc.php";
?>[/code]


Heres my update script code (update_confirm.php):

[code]<?php
require_once("connection.php");
$team = $_GET['team'];
//ob_start();
//include("config.php");
//if($logged['username'])
//{
echo $team;

if(isset($team)){
$team = $_POST['team'];
$against = $_POST['against'];
$kickoff = $_POST['kickoff'];
$meeting = $_POST['meeting'];
$side = $_POST['side'];
$date = $_POST['date']; // what's the date?
list($day, $month, $year) = explode("-", $date); // now split it up
$update = date('Y-m-d', strtotime("$year/$month/$day")); // now re-form it
$p1 = $_POST['p1'];
$p2 = $_POST['p2'];
$p3 = $_POST['p3'];
$p4 = $_POST['p4'];
$p5 = $_POST['p5'];
$p6 = $_POST['p6'];
$p7 = $_POST['p7'];
$p8 = $_POST['p8'];
$p9 = $_POST['p9'];
$p10 = $_POST['p10'];
$p11 = $_POST['p11'];
$p12 = $_POST['p12'];
$p13 = $_POST['p13'];
$p14 = $_POST['p14'];
$p15 = $_POST['p15'];
$p16 = $_POST['p16'];
$p17 = $_POST['p17'];
$p18 = $_POST['p18'];
$p19 = $_POST['p19'];
$p20 = $_POST['p20'];

mysql_select_db("rufc");

$sql = "UPDATE teamplayers SET `against` ='$against', `kickoff` ='$kickoff', `meeting` ='$meeting', `date` ='$update', `p1` ='$p1', `p2` ='$p2', `p3` ='$p3', `p4` ='$p4', `p5` ='$p5', `p6` ='$p6', `p7` ='$p7', `p8` ='$p8', `p9` ='$p9', `p10` ='$p10', `p11` ='$p11', `p12` ='$p12', `p13` ='$p13', `p14` ='$p14', `p15` ='$p15', `p16` ='$p16', `p17` ='$p17', `p18` ='$p18', `p19` ='$p19', `p20` ='$p20' WHERE team = '".$team."'";
mysql_query($sql) or die('Unable to perform query<br />' . mysql_error());

  echo "The selected information was updated! ";
  echo "<a href='playerlist.php?team=1'>Click here</a> to continue";
  echo $sql;
}
// }
// else
// {
// echo 'You do not have permission to access this page, your activity/IP has been logged.';
// }
?>[/code]

I just get a blank page... I'm guessing it isn't carrying the $team variable but I've done this before and it works fine.  ???

Link to comment
https://forums.phpfreaks.com/topic/28840-data-wont-update/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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