paddy100
01-21-2010, 01:29 PM
Hi!
I have been trawling the web for the answer to this but can't nail it! I am a newbie so apologies in advance if my coding is cringeworthy or offends the eyes!:)
I have an issue where i am trying to update a DB for match fixtures with results. the form looks like
[CODE]
<form name="form2" method="post" action="amendfixtures.php">
<label>urn
<input name="urn" type="text" id="urn" size="6" />
</label>
<select name="wl" id="wl">
<option value="won">Won</option>
<option value="lost">Lost</option>
</select>
<p>
for
<input name="for" type="text" id="for" size="3" />
against
<input name="against" type="text" id="against" size="3" />
</p>
<p> </p>
<p>
<input type="submit" value="update" />
</p>
</form>
[CODE]
and the php..
[CODE]
<?php
/* Program to update scores of fixtures in committee area */
include("rhino.inc");
$connection = mysql_connect($host, $user, $password)
or die ("couldn't connect to server");
$db = mysql_select_db($database, $connection)
or die ("couldn't connect to database");
$urn = ($_POST['urn']);
$wl = ($_POST['wl']);
$for = ($_POST['for']);
$against =($_POST['against']);
$update = "UPDATE fixturesresults SET wl ='$wl',for ='$for', against ='$against' WHERE urn ='$urn'";
if(mysql_query($update)){
echo "updated score urn $urn into the database";}
else{
echo "Failed, please try again";}
?>
[CODE]
All i recieve when testing is the fail echo , "Failed, please try again"
My forehead is now sore from banging it against a wall so any help would be appreciated!
my seperate codes for adding & deleting fixtures work like a charm!..
Thanks in advance!
Paddy
I have been trawling the web for the answer to this but can't nail it! I am a newbie so apologies in advance if my coding is cringeworthy or offends the eyes!:)
I have an issue where i am trying to update a DB for match fixtures with results. the form looks like
[CODE]
<form name="form2" method="post" action="amendfixtures.php">
<label>urn
<input name="urn" type="text" id="urn" size="6" />
</label>
<select name="wl" id="wl">
<option value="won">Won</option>
<option value="lost">Lost</option>
</select>
<p>
for
<input name="for" type="text" id="for" size="3" />
against
<input name="against" type="text" id="against" size="3" />
</p>
<p> </p>
<p>
<input type="submit" value="update" />
</p>
</form>
[CODE]
and the php..
[CODE]
<?php
/* Program to update scores of fixtures in committee area */
include("rhino.inc");
$connection = mysql_connect($host, $user, $password)
or die ("couldn't connect to server");
$db = mysql_select_db($database, $connection)
or die ("couldn't connect to database");
$urn = ($_POST['urn']);
$wl = ($_POST['wl']);
$for = ($_POST['for']);
$against =($_POST['against']);
$update = "UPDATE fixturesresults SET wl ='$wl',for ='$for', against ='$against' WHERE urn ='$urn'";
if(mysql_query($update)){
echo "updated score urn $urn into the database";}
else{
echo "Failed, please try again";}
?>
[CODE]
All i recieve when testing is the fail echo , "Failed, please try again"
My forehead is now sore from banging it against a wall so any help would be appreciated!
my seperate codes for adding & deleting fixtures work like a charm!..
Thanks in advance!
Paddy