DJJama
03-22-2010, 05:06 PM
Hi guys.
One problem to the next.
I can now read from the session however I can not convert the output from the runid to runname.
I want the database to store a runid however show the user a name.
Below is the whole code and then the section which is specific to the problem.
Jama
<?php
require("includes/sesh.inc");
require("includes/header.inc");
require("includes/db.inc");
require("includes/menu.inc");
$currentuser = $_SESSION['uid'];
echo "<h1>Run Selection</h1>";
if(isset($_GET['add']))
{
$i = $_POST['rid'];
$r = $_POST['rname'];
$query= "UPDATE userdetails
SET racetrainingfor = $r
WHERE userdetails.userid = $currentuser";
mysql_query($query);
echo "<p>Race Selected</p>";
echo $r;
$query2 = "SELECT runname FROM rundetails WHERE runid=$r";
echo mysql_query($query2);
}
echo "<form action='selectrun.php?add=yes' method='post'>";
echo "<select name='rname'>";
$query1 = "SELECT * FROM rundetails";
$result = mysql_query($query1);
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"<option value= '".$runid."'> ".$runname." </option>";
}
echo "</select>";
echo "<input type='submit' value='Select Race'></p>";
echo "</form>";
require("includes/footer.inc");
?>
$query2 = "SELECT runname FROM rundetails WHERE runid=$r";
echo mysql_query($query2);
One problem to the next.
I can now read from the session however I can not convert the output from the runid to runname.
I want the database to store a runid however show the user a name.
Below is the whole code and then the section which is specific to the problem.
Jama
<?php
require("includes/sesh.inc");
require("includes/header.inc");
require("includes/db.inc");
require("includes/menu.inc");
$currentuser = $_SESSION['uid'];
echo "<h1>Run Selection</h1>";
if(isset($_GET['add']))
{
$i = $_POST['rid'];
$r = $_POST['rname'];
$query= "UPDATE userdetails
SET racetrainingfor = $r
WHERE userdetails.userid = $currentuser";
mysql_query($query);
echo "<p>Race Selected</p>";
echo $r;
$query2 = "SELECT runname FROM rundetails WHERE runid=$r";
echo mysql_query($query2);
}
echo "<form action='selectrun.php?add=yes' method='post'>";
echo "<select name='rname'>";
$query1 = "SELECT * FROM rundetails";
$result = mysql_query($query1);
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"<option value= '".$runid."'> ".$runname." </option>";
}
echo "</select>";
echo "<input type='submit' value='Select Race'></p>";
echo "</form>";
require("includes/footer.inc");
?>
$query2 = "SELECT runname FROM rundetails WHERE runid=$r";
echo mysql_query($query2);