Jump to content

Displaying wrong


sandbudd

Recommended Posts

Could someone please tell me why this displays 3 columns correct and then all moves over.  Here is the page you can see what I am talking about http://www.woodrun.org/includes/news.php I have looked the code over and over and can't see it.  Thanks in advance.

 

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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;
}
}

$maxRows_Recordset1 = 1000000;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_woodrun, $woodrun);
$query_Recordset1 = "SELECT * FROM news ORDER BY id DESC" ;
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $woodrun) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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_fwragain, $fwragain);
$query_Recordset1 = "SELECT * FROM news ORDER BY id DESC";
$Recordset1 = mysql_query($query_Recordset1, $woodrun) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">
  <?php do { ?>
  <tr>
    <td colspan="4" align="left" valign="top"><?php echo "<img src=http://woodrun.org/images/".$row_Recordset1['photo'] ."> "; ?></td>
    <td width="550" align="left" valign="top"><?php echo $row_Recordset1['title']; ?>
      <hr />
      <?php echo $row_Recordset1['article']; ?><br /></td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>



  <?php
mysql_free_result($Recordset1);
?>

Link to comment
https://forums.phpfreaks.com/topic/209154-displaying-wrong/
Share on other sites

try it this way

 

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$i = 0;

?>

<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">

<?php while ($i <= $totalRows_Recordset1) { ?>

<tr>

<td colspan="4" align="left" valign="top"><?php echo "<img src=http://woodrun.org/images/".$row_Recordset1['photo']."> "; ?></td>

<td width="550" align="left" valign="top"><?php echo $row_Recordset1['title']; ?>

<hr />

<?php echo $row_Record_set1['article']; ?><br /> </td>

</tr>

<?php $i++;

} ?>

</table>

 

edit: i forgot the $i++ at the end of the loop.

 

Link to comment
https://forums.phpfreaks.com/topic/209154-displaying-wrong/#findComment-1092308
Share on other sites

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$i = 0;

?>

<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">

<?php while ($i <= $totalRows_Recordset1 && $row_Recordset1 = mysql_fetch_assoc($Recordset1)) { ?>

<tr>

<td colspan="4" align="left" valign="top"><?php echo "<img src=http://woodrun.org/images/".$row_Recordset1['photo']."> "; ?></td>

<td width="550" align="left" valign="top"><?php echo $row_Recordset1['title']; ?>

<hr />

<?php echo $row_Recordset1['article']; ?><br /> </td>

</tr>

<?php $i++;

} ?>

</table>

 

there, now even if it just sticks with the 1 article, it'll have the description -- i had an unwanted underscore in the variable name of that echo.

Link to comment
https://forums.phpfreaks.com/topic/209154-displaying-wrong/#findComment-1092314
Share on other sites

hmm the html output of whats up, is completely different than what we have up..  let me look at that html output a bit and see where the error might be...

 

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$i = 0;

?>

<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">

<?php while ($i <= $totalRows_Recordset1 && $row_Recordset1 = mysql_fetch_assoc($Recordset1)) { ?>

<tr>

<td colspan="4" align="left" valign="top"><?php echo "<img src=http://woodrun.org/images/".$row_Recordset1['photo']."> "; ?></td>

<td width="550" align="left" valign="top"><?php echo $row_Recordset1['title']; ?><hr /><?php echo $row_Recordset1['article']; ?></td>

</tr>

<?php $i++;

} ?>

</table>

 

 

try this, see if this helps.. looking at the source code this could fix the issue.

Link to comment
https://forums.phpfreaks.com/topic/209154-displaying-wrong/#findComment-1092328
Share on other sites

Look in the database for the entry titled It (the 2nd one), im willing to bet the issue lies there since thats where the issue starts.

 

in fact, right at the beginning of it somewhere, you probably have:

 

<table width="100%" align="center" border="0" cellpadding="5" cellspacing="5"> in there...

 

 

Link to comment
https://forums.phpfreaks.com/topic/209154-displaying-wrong/#findComment-1092345
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.