Welcome! Log In Create A New Profile

Advanced

update.php

Posted by 39651088 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
update.php
October 26, 2013 02:12PM
please assist here, it says:

Notice: Undefined index: player_id in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 16

Notice: Undefined index: name in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 17

Notice: Undefined index: surname in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 18

Notice: Undefined index: contact_number in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 19

Notice: Undefined index: email in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 20

Notice: Undefined index: position in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 21

Notice: Undefined index: username in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 22

Notice: Undefined index: password in C:\Users\Motsethebe\Documents\easyPHP\www\Projects\test\update_player.php on line 23
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 12

code:
<?php
$config="config.php";
if(file_exists($config)){
include($config);
}else{
echo "file error";
}

$connection = mysql_connect($host,$user,$pass);
if($connection){
$select_db=mysql_select_db($db,$connection) or die(mysql_error());
}else{
die(mysql_error());
}

$player_id = $_GET['player_id'];
$name = $_GET['name'];
$surname = $_GET['surname'];
$contact_number= $_GET['contact_number'];
$email = $_GET['email'];
$position = $_GET['position'];
$username = $_GET['username'];
$password = $_GET['password'];

$query = "UPDATE
list_players
SET
name='$name',
surname='$surname',
contact_number='$contact_number',
email='$email',
position='$position',
username='$username',
password='$password'
WHERE
player_id=$player_id";
$result=mysql_query($query) or die(mysql_error());
if($result){
echo "Updated";
}else{
echo "error updating record";
}
?>
<br /><a href="list_players.php">List Players</a>|<br /><a href="insert_player.php">Insert Player</a>
avatar Re: update.php
October 26, 2013 03:18PM
Language: PHP
$player_id = $_GET[';player_id';]; $name = $_GET[';name';]; $surname = $_GET[';surname';]; $contact_number= $_GET[';contact_number';]; $email = $_GET[';email';]; $position = $_GET[';position';]; $username = $_GET[';username';]; $password = $_GET[';password';];

You should check that the $_GET array isset before trying to extract data from it.

How do you put data into the $_GET array ?
Sorry, only registered users may post in this forum.

Click here to login