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
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
Share on other sites

alright lemme rework it or just add this into the while line of the code:

 

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

 

so it would look like:

 

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

Link to comment
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
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
Share on other sites

lets just try something for shits and giggles...

 

take out the

<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5"> line all together...  i just spotted a spot that has that listed twice one under the other.

Link to comment
Share on other sites

if the HTML output wasnt so different than what we've got here this would be easier but it nearly completely changes...  unless all that xml and css stuff is in the database stored with the 'article'...  this is confusing me though ;D

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.