i have a page that works fine using sesson this one here
<?php
include("../php-login-script-v1.0/session.php");
require_once('../Connections/stablemaster.php');
$user_name = $_SESSION['user'];
$user_id = $_SESSION['uid'];
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_stablemaster, $stablemaster);
$query_Recordset1 = "SELECT stable_name, user_email, country FROM users WHERE id='".$user_id."'";
$Recordset1 = mysql_query($query_Recordset1, $stablemaster) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_stablemaster, $stablemaster);
$query_horsehistory = "SELECT * FROM horse_stats WHERE stable_name = '".$row_Recordset1['stable_name']."'";
$horsehistory = mysql_query($query_horsehistory, $stablemaster) or die(mysql_error());
$row_horsehistory = mysql_fetch_assoc($horsehistory);
$totalRows_horsehistory = mysql_num_rows($horsehistory);
mysql_select_db($database_stablemaster, $stablemaster);
$query_JOCKSTATS = "SELECT * FROM jocky_stats WHERE stable_name = '".$row_Recordset1['stable_name']."'";
$JOCKSTATS = mysql_query($query_JOCKSTATS, $stablemaster) or die(mysql_error());
$row_JOCKSTATS = mysql_fetch_assoc($JOCKSTATS);
$totalRows_JOCKSTATS = mysql_num_rows($JOCKSTATS);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Stable Stats</title>
<meta http-equiv="Expires" content="0" />
<META HTTP-EQUIV="cache-control" CONTENT="no-cache" />
<link href="file:///C|/wamp/www/WEBISTE BUILDING/Style Sheets/Fonts.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Fonts tr td {
color: #000;
}
#stable_finances tr td h1 {
font-variant: small-caps;
color: #FF0;
}
#stable_finances2 tr td h2 {
background-color: #30F;
color: #FF0;
}
-->
</style>
<link href="file:///C|/wamp/www/WEBISTE BUILDING/Style Sheets/heading2.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
background-color: #BFEBFF;
}
#stable_stats tr td div h2 {
color: #00F;
}
#stable_stats tr td table tr td div {
color: #FFF;
}
-->
</style></head>
<body onload="startTime()">
<div align="center">
<div align="center">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr> </tr>
</table>
</div>
<div id="txt"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#BFEBFF"><form name="form1" method="post" action="">
<table width="60%" border="0" align="center" cellpadding="1" cellspacing="1" id="stable_stats">
<tr>
<td colspan="2" bgcolor="#BFEBFF"><div align="center">
<h2>Stable Stats</h2>
</div></td>
</tr>
<tr>
<td>Stable Name</td>
<td><label for="stable_name"></label>
<input name="stable_name" type="text" id="stable_name" value="<?php echo $row_Recordset1['stable_name']; ?>" size="30" maxlength="45" /></td>
</tr>
<tr>
<td>Email</td>
<td><label for="email"></label>
<input name="email" type="text" id="email" value="<?php echo $row_Recordset1['user_email']; ?>" size="30" maxlength="40" /></td>
</tr>
<tr>
<td>country</td>
<td><label for="country"></label>
<input name="country" type="text" id="country" value="<?php echo $row_Recordset1['country']; ?>" size="30" maxlength="20" /></td>
</tr>
</table>
</form></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="Fonts" id="stable_stats">
<tr>
<td width="100%" bgcolor="#BFEBFF"><div align="center">
<h2> </h2>
<h2>Current Horses</h2>
</div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="1" cellpadding="1" cellspacing="1">
<tr>
<td width="13%" bgcolor="#0000FF"><div align="center">Name</div></td>
<td width="10%" bgcolor="#0000FF"><div align="center">Age</div></td>
<td width="10%" bgcolor="#0000FF"><div align="center">Gen</div></td>
<td width="11%" bgcolor="#0000FF"><div align="center">Bred</div></td>
<td width="10%" bgcolor="#0000FF"><div align="center">Xp</div></td>
<td width="10%" bgcolor="#0000FF"><div align="center">Ran</div></td>
<td width="11%" bgcolor="#0000FF"><div align="center">Won</div></td>
<td width="12%" bgcolor="#0000FF"><div align="center">Shown</div></td>
<td width="13%" bgcolor="#0000FF"><div align="center">Winnings</div></td>
</tr>
<?php do { ?>
<tr>
<td nowrap><a href="../Horse_history.php?horse=<?php echo $row_horsehistory['name_id']; ?>"><?php echo $row_horsehistory['name_id']; ?></a></td>
<td><?php echo $row_horsehistory['age']; ?></td>
<td><?php echo $row_horsehistory['gen']; ?></td>
<td><?php echo $row_horsehistory['bred']; ?></td>
<td><?php echo $row_horsehistory['xp']; ?></td>
<td><?php echo $row_horsehistory['ran']; ?></td>
<td><?php echo $row_horsehistory['won']; ?></td>
<td><?php echo $row_horsehistory['shown']; ?></td>
<td><?php echo $row_horsehistory['winnings']; ?></td>
</tr>
<?php } while ($row_horsehistory = mysql_fetch_assoc($horsehistory)); ?>
</table></td>
</tr>
<tr>
<td bgcolor="#BFEBFF"><div align="center">
<h2> </h2>
<h2>Current Jockeys</h2>
</div></td>
</tr>
<tr>
<td><table width="100%" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<td bgcolor="#0000FF"><div align="center">Jocky Name</div></td>
<td bgcolor="#0000FF"><div align="center">Age</div></td>
<td bgcolor="#0000FF"><div align="center">Run</div></td>
<td bgcolor="#0000FF"><div align="center">Won</div></td>
<td bgcolor="#0000FF"><div align="center">Place</div></td>
<td bgcolor="#0000FF"><div align="center">Moral</div></td>
<td bgcolor="#0000FF"><div align="center">Rating</div></td>
<td bgcolor="#0000FF"><div align="center">Winnings</div></td>
</tr>
<?php do { ?>
<tr>
<td bgcolor="#FFFFFF"><a href="../jocky_history.php?jocky=<?php echo $row_JOCKSTATS['Jocky_name']; ?>"><?php echo $row_JOCKSTATS['Jocky_name']; ?></a></td>
<td bgcolor="#FFFFFF"><?php echo $row_JOCKSTATS['age']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_JOCKSTATS['run']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_JOCKSTATS['won']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_JOCKSTATS['place']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_JOCKSTATS['moral']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_JOCKSTATS['rating']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_JOCKSTATS['winnings']; ?></td>
</tr>
<?php } while ($row_JOCKSTATS = mysql_fetch_assoc($JOCKSTATS)); ?>
</table><h2> </h2></td>
</tr>
</table>
</form></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
</div>
</body>
</html>
<?php
mysql_free_result($horsehistory);
mysql_free_result($JOCKSTATS);
mysql_free_result($Recordset1);
?>
i want to make this one use the same session but its just not happening.
i will put the pages as uploads the stable statistics.php is fine
the horse summary is not .
the page itself is ok but it comes up with all the horses instead of just the users horses here is the page
<?php require_once('Connections/stablemaster.php');
require_once('../Connections/stablemaster.php');
session_start();
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_stablemaster, $stablemaster);
$query_Recordset1 = "SELECT * FROM horse_stats";
$Recordset1 = mysql_query($query_Recordset1, $stablemaster) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Horse summary</title>
<style type="text/css">
<!--
body {
background-color: #BFEBFF;
color: #000;
}
-->
</style>
<link href="Style Sheets/FONTBLUE.css" rel="stylesheet" type="text/css" /></head>
<?php
do {
?>
<table width="900" border="10" cellspacing="5" cellpadding="1">
<tr>
<td width="150" bgcolor="#CCCCCC"><h3 align="center">
<a href="../Horse_history.php?horse=<?php echo $row_horsehistory['name_id']; ?>">
<?php echo $row_Recordset1['name_id']; ?></a></h3></td>
<td nowrap="nowrap" bgcolor="#CCCCCC"><h4 align="center">
Overall Rating</h4></td>
<td nowrap="nowrap" bgcolor="#CCCCCC"><h3 align="center">
<?php echo $row_Recordset1['xp']; ?></h3></td>
<td nowrap="nowrap" bgcolor="#CCCCCC"><h3 align="center">
Date Time Details</h3></td>
</tr>
<tr>
<td width="150" height="150" align="center" valign="top"><div align="center">
<img src='../Horse image/<?php echo $row_Recordset1["image"]?>' /></div></td>
<td width="120" valign="top" nowrap="nowrap" class="FONTBLUE">
Age<br />
Gen<br />
Medical:<br />
Physical:<br />
Ran / Won<br />
Career earnings:<br />
Latest race:</td>
<td width="150" valign="top" nowrap="nowrap">
(<?php echo $row_Recordset1['age']; ?>)<br />
<?php echo $row_Recordset1['gen']; ?><br />
<?php echo $row_Recordset1['medical_condition']; ?><br />
<?php echo $row_Recordset1['physical_condition']; ?><br />
(<?php echo $row_Recordset1['ran']; ?>)(
<?php echo $row_Recordset1['won']; ?>)<br />
<?php echo $row_Recordset1['career_earnings']; ?><br />
<?php echo $row_Recordset1['latest_race']; ?><br /></td>
<td width="480" align="left" valign="top" nowrap="nowrap"></td>
</tr>
</table>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<p> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
i would apritiate the help as there is a lot of pages that will need to use the same sessions
Attached File(s)
-
stable_statistics.php (9.33K)
Number of downloads: 37 -
Horse_summary.php (3.75K)
Number of downloads: 36
This post has been edited by peter yianni: 02 July 2009 - 11:20 AM

New Topic/Question
Reply




MultiQuote






|