PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 300,344 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,571 people online right now. Registration is fast and FREE... Join Now!




bringing in the wrong results

 

bringing in the wrong results

peter yianni

1 Jul, 2009 - 04:05 PM
Post #1

D.I.C Regular
***

Joined: 4 Jun, 2009
Posts: 308



Thanked: 2 times
My Contributions
ok thought it was a problem with sessions at first but after doing the session query i know thats not the problem
whats happening its bringing all the results from a row instead of the users results
i have tried many different things still get the same problem
i am sure its somthing to do with the where clause if any one can help me on this please it will be much apritiated

CODE

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

require_once('Connections/general_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 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: #6CF;
    color: #000;
}
-->
</style>

<link href="Style Sheets/FONTBLUE.css" rel="stylesheet" type="text/css" /></head>


<?php

do {

?>
        <table width="900" border="5" 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">Upcoming Scedule</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"><h4>Date&nbsp;&nbsp; Time&nbsp;&nbsp; Details</h4>
  </h4>
  </div></td>
  </tr>
  </table>

  <br />
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>


thats the page that brings the results but bringing everything in from the same row .
i need just the sessions user things to be brought in



User is offlineProfile CardPM
+Quote Post


CamoDeveloper

RE: Bringing In The Wrong Results

1 Jul, 2009 - 08:23 PM
Post #2

D.I.C Head
Group Icon

Joined: 12 Jun, 2009
Posts: 204



Thanked: 12 times
Dream Kudos: 200
My Contributions
Is the SELECT statement you're using the one that's defined in the code itself? The SELECT * FROM horse_stats will select all the data from that table. Do you want only a certain field to be pulled from that table?

~Camo
User is offlineProfile CardPM
+Quote Post

BetaWar

RE: Bringing In The Wrong Results

1 Jul, 2009 - 09:47 PM
Post #3

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 4,729



Thanked: 269 times
Dream Kudos: 1400
My Contributions
Moved to PHP
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 05:50PM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month