Not Pulling the right results

I AM STUCK

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 769 Views - Last Post: 22 August 2009 - 01:44 PM Rate Topic: -----

#1 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Not Pulling the right results

Post icon  Posted 20 August 2009 - 03:10 PM

i am having a problem with this i have got the link opening a new page which should show the race entrys in a race.
at the moment u open the page and it always shows just the last result in the rease schedules plt the information for the hore and stable and jocks is all reapeating this is what it looks like.

Race Date/Time Ground Distance Stakes Value
Ripon 2009-08-22 05:30:00 soft 1.5m 85560

Number Form Stable Horse Jocky Odds
1 ADMIN Broadfields P Hanagan
2 ADMIN Broadfields P Hanagan
3 ADMIN Broadfields P Hanagan
4 ADMIN Broadfields P Hanagan
5 ADMIN Broadfields P Hanagan
6 ADMIN Broadfields P Hanagan
7 ADMIN Broadfields P Hanagan
8 ADMIN Broadfields P Hanagan
9 ADMIN Broadfields P Hanagan

ok this is the page that has the link to the tracks
<?php require_once('../Connections/stablemaster.php');

require_once('../Connections/general_class.php');
require_once('../Connections/Races_class.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;
}
}
?>
<?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 * FROM Racetracks ORDER BY Racetracks.Race_date";
$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>Leauge  Winners</title>

<style type="text/css">
<!--
body {
	background-image: url(../Images/grass-natural.jpg);
	background-repeat: repeat;
}
-->
</style>
<link href="../Style Sheets/opacy.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {font-size: 16px}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
	color: #00F;
}
a:active {
	text-decoration: none;
}
body,td,th {
	font-family: Comic Sans MS, cursive;

	font-weight: bold;
}
-->
</style>
</head>

<body text="#000000" link="#0066FF" vlink="#FF0000" alink="#FFFFFF">
</head>

<body>
<table width="100%" border="0" cellpadding="1" cellspacing="1">
  <tr class="Fonts">
	<td width="20%" bgcolor="#33FF00"><div align="center">HORSE</div></td>
	<td width="15%" bgcolor="#33FF00"><div align="center">RACE</div></td>
	<td width="10%" bgcolor="#33FF00"><div align="center">DISTANCE</div></td>
	<td width="25%" nowrap="nowrap" bgcolor="#33FF00"><div align="center">DATE-TIME</div></td>
	<td width="15%" bgcolor="#33FF00"><div align="center">VALUE</div></td>
	<td width="15%" bgcolor="#33FF00"><div align="center">GROUND</div></td>
	<td width="5%" nowrap="nowrap" bgcolor="#33FF00"><div align="center">Track id</div></td>
	
  </tr>
</table>
<?php do { 
$horsequery = "SELECT name_id FROM horse_stats WHERE `Key id`='".$row_Recordset1['horseid']."'";
$horse1 = mysql_query($horsequery, $stablemaster) or die(mysql_error());
$horse = mysql_fetch_assoc($horse1);
$trackquery = "SELECT Track_id FROM Racetracks WHERE `Track_id`='".$row_Recordset1['Track_id']."'";
$track1 = mysql_query($trackquery, $stablemaster) or die(mysql_error());
$track = mysql_fetch_assoc($track1);
?>

  <table width="100%" border="0" cellspacing="1" cellpadding="1">
	<tr>
	 <td width="20%" align="center" bgcolor="#FFFFFF"><strong><a href="../Horse Finance/Horse_history.php?horse=<?php echo $horse['name_id']; ?>"><?php echo $horse['name_id']; ?></a>
	   </strong></td>
	  <td  width="15%" align="center" nowrap="nowrap"><div align="center"class="setOpacity"><strong><?php echo $row_Recordset1['Track_name']; ?></strong></div></td>
	  <td width="10%" align="center" nowrap="nowrap"><div align="center"class="setOpacity"><strong><?php echo $row_Recordset1['Race_length']; ?></strong></div></td>
	  <td width="25%" align="center" nowrap="nowrap"><div align="center"class="setOpacity"><strong><?php echo $row_Recordset1['Race_date']; ?></strong></div></td>
	  <td width="15%" align="center" nowrap="nowrap"><div align="center"class="setOpacity"><strong><?php echo $row_Recordset1['Stakes_amount']; ?></strong></div></td>
	  <td width="15%" align="center" nowrap="nowrap"><div align="center"class="setOpacity"><strong><?php echo $row_Recordset1['Ground_cond']; ?></strong></div></td>
	  <td width="5%" align="center" nowrap="nowrap"><div align="center"class="setOpacity"><strong><a href="Track.php?Track=<?php echo $row_Recordset1['Track_id']; ?>" class="blackfont"><?php echo $row_Recordset1['Track_id']; ?></a></strong></div></td>
		 </tr>
</table>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>



once there u have a track id link which all shows corectly with the id of the race if u click on the link it opens this page .
which has the info i showed up the top i have been playing with this page for some time now getting it to bring the right results but no luck
can anyone see where i am going wrong please heres the track id page

<?php require_once('../Connections/stablemaster.php');

require_once('../Connections/general_class.php');
require_once('../Connections/Races_class.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 Racetracks WHERE Track_id=Track_id";
$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=iso-8859-1" />
<title>Entrys</title>
<style type="text/css">
<!--
body {
	background-color: #00D5D5;
	background-image: url(../Images/grass-natural.jpg);
}
-->
</style></head>

<body>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
<?php
$trackquery = "SELECT Track_id FROM Racetracks WHERE `Track_id`='".$row_Recordset1['Track_name']."'";
$track1 = mysql_query($trackquery, $stablemaster) or die(mysql_error());
$track = mysql_fetch_assoc($track1);
?>
	<td colspan="5"><h2 align="center"> Entrys Track <?php echo $row_Recordset1['Track_id']; ?></h2></td>
  </tr>
  <tr bgcolor="#F1DC57">
	<td nowrap="nowrap"><div align="center"><strong>	  Race</strong></div></td>
	<td nowrap="nowrap"><div align="center"><strong>	  Date/Time</strong></div></td>
	<td nowrap="nowrap"><div align="center"><strong>	  Ground</strong></div></td>
	<td nowrap="nowrap"><div align="center"><strong>	  Distance</strong></div></td>
	<td nowrap="nowrap"><div align="center"><strong>	  Stakes Value </strong></div></td>
  </tr>
  <tr align="center" bgcolor="#CCCCCC">
	<td><strong><?php echo $row_Recordset1['Track_name']; ?></strong></td>
	<td><strong><?php echo $row_Recordset1['Race_date']; ?></strong></td>
	<td><strong><?php echo $row_Recordset1['Ground_cond']; ?></strong></td>
	<td><strong><?php echo $row_Recordset1['Race_length']; ?></strong></td>
	<td><strong><?php echo $row_Recordset1['Stakes_amount']; ?></strong></td>
  </tr>
  <tr align="center">
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<td width="17%" align="center" bgcolor="#F1DC57"><strong>Number</strong></td>
	<td width="18%" align="center" bgcolor="#F1DC57"><strong>Form</strong></td>
	<td width="17%" align="center" bgcolor="#F1DC57"><strong>Stable</strong></td>
	<td width="17%" align="center" bgcolor="#F1DC57"><strong>Horse</strong></td>
	<td width="16%" align="center" bgcolor="#F1DC57"><strong>Jocky</strong></td>
	<td width="15%" align="center" bgcolor="#F1DC57"><strong>Odds</strong></td>
  </tr>
  
<?php
$horsequery = "SELECT name_id FROM horse_stats WHERE `Key id`='".$row_Recordset1['horseid']."'";
$horse1 = mysql_query($horsequery, $stablemaster) or die(mysql_error());
$horse = mysql_fetch_assoc($horse1);
$stablequery = "SELECT stable_name FROM users WHERE `id`='".$row_Recordset1['userid']."'";
$stable1 = mysql_query($stablequery, $stablemaster) or die(mysql_error());
$stable = mysql_fetch_assoc($stable1);
$jockquery = "SELECT Jocky_name FROM jocky_stats WHERE `Key id`='".$row_Recordset1['Jockid']."'";
$jock1 = mysql_query($jockquery, $stablemaster) or die(mysql_error());
$jock = mysql_fetch_assoc($jock1); 
?>
<?php $x = (is_numeric($_GET['x'])) ? $_GET['x'] : 0; do { $x++; ?>
  <tr bgcolor="#CCCCCC">
	<td align="center"><?php echo $x; ?></td>
	<td align="center"><?php echo $row_Recordset1['form']; ?></td>
	<td align="center"><?php echo $stable['stable_name']; ?></td>
	<td align="center"><?php echo $horse['name_id']; ?></td>
	<td align="center"><?php echo $jock['Jocky_name']; ?></td>
	<td align="center">&nbsp;</td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);

?>



Is This A Good Question/Topic? 0
  • +

Replies To: Not Pulling the right results

#2 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 5750
  • View blog
  • Posts: 10,074
  • Joined: 28-September 07

Re: Not Pulling the right results

Posted 21 August 2009 - 04:04 AM

$query_Recordset1 = "SELECT * FROM Racetracks ORDER BY Racetracks.Race_date";



I don't believe you need to include the "Racetracks" in "Racetracks.Race_date"... and you listed the ORDER BY, but not an order (ASC/DESC).

$horsequery = "SELECT name_id FROM horse_stats WHERE `Key id`='".$row_Recordset1['horseid']."'";



There is a space in "Key id" and no space in "horseid". Are these correct?

$totalRows_Recordset1 = mysql_num_rows($Recordset1);



Where does this piece of code actually get used?


And a suggestion, if I may:
Develop a naming convention for your data fields (ie, all lowercase, all uppercase, underscore between words, etc) and stick to it. It makes it MUCH easier for those of us who cannot see your database to determine if your entire problem revolves around a spelling error. Just a thought.
Was This Post Helpful? 0
  • +
  • -

#3 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Re: Not Pulling the right results

Posted 21 August 2009 - 11:16 AM

[quote name='BenignDesign' post='742276' date='21 Aug, 2009 - 03:04 AM']
$query_Recordset1 = "SELECT * FROM Racetracks ORDER BY Racetracks.Race_date";



I don't believe you need to include the "Racetracks" in "Racetracks.Race_date"... and you listed the ORDER BY, but not an order (ASC/DESC).

$horsequery = "SELECT name_id FROM horse_stats WHERE `Key id`='".$row_Recordset1['horseid']."'";



There is a space in "Key id" and no space in "horseid". Are these correct?

yes that is corect have to many pages working with it to late to chage now

$totalRows_Recordset1 = mysql_num_rows($Recordset1);



Where does this piece of code actually get used?

i have removed that piece of code mistake when i added dont need it

the first page pulls the results its working fine i have the links in there which take u two second page which should show just the track entrys by track id when u click on track id link but not bringing the corect track
kepps bring the same track whichever link u click on

This post has been edited by peter yianni: 21 August 2009 - 11:25 AM

Was This Post Helpful? 0
  • +
  • -

#4 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 5750
  • View blog
  • Posts: 10,074
  • Joined: 28-September 07

Re: Not Pulling the right results

Posted 21 August 2009 - 11:56 AM

$query_Recordset1 = "SELECT * FROM Racetracks WHERE Track_id=Track_id";



Where are you getting Track_id? I see where you pass it in the URL, but you're not pulling back down on the next page.
Was This Post Helpful? 0
  • +
  • -

#5 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Re: Not Pulling the right results

Posted 21 August 2009 - 12:10 PM

View PostBenignDesign, on 21 Aug, 2009 - 10:56 AM, said:

$query_Recordset1 = "SELECT * FROM Racetracks WHERE Track_id=Track_id";



Where are you getting Track_id? I see where you pass it in the URL, but you're not pulling back down on the next page.



this is the link on first page which calls the results
they then show up as links on that page with track id numbers
u should just click the number and it should just get the results for that track id but it brings one track al all the same
  <td width="5%" align="center" nowrap="nowrap"><div align="center"class="setOpacity"><strong><a href="Track.php?Track=<?php echo $row_Recordset1['Track_id']; ?>" class="blackfont"><?php echo $row_Recordset1['Track_id']; ?></a></strong></div></td>



Was This Post Helpful? 0
  • +
  • -

#6 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 5750
  • View blog
  • Posts: 10,074
  • Joined: 28-September 07

Re: Not Pulling the right results

Posted 21 August 2009 - 04:05 PM

Exactly.

So, on page 1, your link is (hypothetically) page2.php?Track=4

On page 2, you are querying the database for records associated with the Track_id, but you aren't GETTING the Track_id on the page.
One of your first lines on page 2 should be
<?php
$Track_id=$_GET['Track'];
?>



And in your query, it would be
$query_Recordset1 = "SELECT * FROM Racetracks WHERE Track_id=$Track_id";


This post has been edited by BenignDesign: 21 August 2009 - 04:06 PM

Was This Post Helpful? 1
  • +
  • -

#7 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Re: Not Pulling the right results

Posted 21 August 2009 - 04:24 PM

View PostBenignDesign, on 21 Aug, 2009 - 03:05 PM, said:

Exactly.

So, on page 1, your link is (hypothetically) page2.php?Track=4

On page 2, you are querying the database for records associated with the Track_id, but you aren't GETTING the Track_id on the page.
One of your first lines on page 2 should be
<?php
$Track_id=$_GET['Track'];
?>



And in your query, it would be
$query_Recordset1 = "SELECT * FROM Racetracks WHERE Track_id=$Track_id";




now seem to have done somthing now getting the track but the entrys are all showing the same

Race

Date/Time

Ground

Distance

Stakes Value
Ripon 2009-08-22 05:30:00 soft 1.5m 85560

Number Form Stable Horse Jocky Odds
1 ADMIN Broadfields P Hanagan
2 ADMIN Broadfields P Hanagan
3 ADMIN Broadfields P Hanagan

so it is pulling the amount of entrys in there and the 1 corect horse but its not showing the other 2 horses

This post has been edited by peter yianni: 21 August 2009 - 04:26 PM

Was This Post Helpful? 0
  • +
  • -

#8 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,737
  • Joined: 08-August 08

Re: Not Pulling the right results

Posted 21 August 2009 - 04:40 PM

That's because you're not using the data it pulls:
do { $x++; ?>
  <tr bgcolor="#CCCCCC">
	<td align="center"><?php echo $x; ?></td>
	<td align="center"><?php echo $row_Recordset1['form']; ?></td>
	<td align="center"><?php echo $stable['stable_name']; ?></td>
	<td align="center"><?php echo $horse['name_id']; ?></td>
	<td align="center"><?php echo $jock['Jocky_name']; ?></td>
	<td align="center"> </td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>


The arrays: $stable, $horse and $jock are not affected by the query or $row_Recordset1. Try using
$row_Recordset1['stable_name']
$row_Recordset1['name_id']
$row_Recordset1['Jocky_name']
Was This Post Helpful? 0
  • +
  • -

#9 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Re: Not Pulling the right results

Posted 21 August 2009 - 05:05 PM

View PostCTphpnwb, on 21 Aug, 2009 - 03:40 PM, said:

That's because you're not using the data it pulls:
do { $x++; ?>
  <tr bgcolor="#CCCCCC">
	<td align="center"><?php echo $x; ?></td>
	<td align="center"><?php echo $row_Recordset1['form']; ?></td>
	<td align="center"><?php echo $stable['stable_name']; ?></td>
	<td align="center"><?php echo $horse['name_id']; ?></td>
	<td align="center"><?php echo $jock['Jocky_name']; ?></td>
	<td align="center"> </td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>


The arrays: $stable, $horse and $jock are not affected by the query or $row_Recordset1. Try using
$row_Recordset1['stable_name']
$row_Recordset1['name_id']
$row_Recordset1['Jocky_name']



tried that now there all blank

<?php
$horsequery = "SELECT name_id,form FROM horse_stats WHERE `Key id`='".$row_Recordset1['horseid']."'";
$horse1 = mysql_query($horsequery, $stablemaster) or die(mysql_error());
$horse = mysql_fetch_assoc($horse1);
$stablequery = "SELECT stable_name FROM users WHERE `id`='".$row_Recordset1['userid']."'";
$stable1 = mysql_query($stablequery, $stablemaster) or die(mysql_error());
$stable = mysql_fetch_assoc($stable1);
$jockquery = "SELECT Jocky_name FROM jocky_stats WHERE `Key id`='".$row_Recordset1['Jockid']."'";
$jock1 = mysql_query($jockquery, $stablemaster) or die(mysql_error());
$jock = mysql_fetch_assoc($jock1); 
?>
<?php $x = (is_numeric($_GET['x'])) ? $_GET['x'] : 0; do { $x++; ?>
  <tr bgcolor="#CCCCCC">
	<td align="center"><?php echo $x; ?></td>
	<td align="center"><?php echo $row_Recordset1['form']; ?></td>
	<td align="center"><?php echo $row_Recordset1['stable_name']; ?></td>
	<td align="center"><?php echo $row_Recordset1['name_id']; ?></td>
	<td align="center"><?php echo $row_Recordset1['Jocky_name']; ?></td>
	<td align="center">&nbsp;</td>


Was This Post Helpful? 0
  • +
  • -

#10 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,737
  • Joined: 08-August 08

Re: Not Pulling the right results

Posted 21 August 2009 - 05:08 PM

Are those the right names for that table?
Was This Post Helpful? 0
  • +
  • -

#11 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Re: Not Pulling the right results

Posted 21 August 2009 - 05:12 PM

View PostCTphpnwb, on 21 Aug, 2009 - 04:08 PM, said:

Are those the right names for that table?


sorry
now i put the right names for the tables i get the results like this
1 40 81 1
2 56 93 52

which seem correct i have now got to get it to show the names
Was This Post Helpful? 0
  • +
  • -

#12 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,737
  • Joined: 08-August 08

Re: Not Pulling the right results

Posted 21 August 2009 - 05:23 PM

You'll want to use $row_Recordset1['horseid'] to look up name_id using 'Key id' in the horse_stats table.
Was This Post Helpful? 0
  • +
  • -

#13 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Re: Not Pulling the right results

Posted 21 August 2009 - 05:34 PM

View PostCTphpnwb, on 21 Aug, 2009 - 04:23 PM, said:

You'll want to use $row_Recordset1['horseid'] to look up name_id using 'Key id' in the horse_stats table.


which this was doing before

<?php
$horsequery = "SELECT name_id,form FROM horse_stats WHERE `Key id`='".$row_Recordset1['horseid']."'";
$horse1 = mysql_query($horsequery, $stablemaster) or die(mysql_error());
$horse = mysql_fetch_assoc($horse1);
$stablequery = "SELECT stable_name FROM users WHERE `id`='".$row_Recordset1['userid']."'";
$stable1 = mysql_query($stablequery, $stablemaster) or die(mysql_error());
$stable = mysql_fetch_assoc($stable1);
$jockquery = "SELECT Jocky_name FROM jocky_stats WHERE `Key id`='".$row_Recordset1['Jockid']."'";
$jock1 = mysql_query($jockquery, $stablemaster) or die(mysql_error());
$jock = mysql_fetch_assoc($jock1); 
?>



have tried changing to recordsett brings in empty query
Was This Post Helpful? 0
  • +
  • -

#14 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,737
  • Joined: 08-August 08

Re: Not Pulling the right results

Posted 21 August 2009 - 06:26 PM

You need to do it inside the do...while loop so that you get the name of each horse as it's selected.
Was This Post Helpful? 0
  • +
  • -

#15 peter yianni  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 310
  • Joined: 04-June 09

Re: Not Pulling the right results

Posted 21 August 2009 - 09:45 PM

View PostCTphpnwb, on 21 Aug, 2009 - 05:26 PM, said:

You need to do it inside the do...while loop so that you get the name of each horse as it's selected.


have been trying to do that thats why i am getting the errors
been trying to do a do while
and getting untold errors still pluging away trying to fix
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2