TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 08-19-2008, 08:00 PM   #1 (permalink)
The Wanderer
 
frosty's Avatar
 
Join Date: Aug 2008
Location: texas
Posts: 13
Thanks: 3
frosty is on a distinguished road
Help Ok, my first real issue!!

I am looking for an "easy" (nothing is easy right) way to alternate the row colors in the code block below...

PHP Code:

<?php require_once('../Connections/add.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;
}
}

$currentPage $_SERVER["PHP_SELF"];

$maxRows_TerminalList 50;
$pageNum_TerminalList 0;
if (isset(
$_GET['pageNum_TerminalList'])) {
  
$pageNum_TerminalList $_GET['pageNum_TerminalList'];
}
$startRow_TerminalList $pageNum_TerminalList $maxRows_TerminalList;

mysql_select_db($database_jpbdadd$jpbdadd);
$query_TerminalList "SELECT * FROM xx";
$query_limit_TerminalList sprintf("%s LIMIT %d, %d"$query_TerminalList$startRow_TerminalList$maxRows_TerminalList);
$TerminalList mysql_query($query_limit_TerminalList$jpbdadd) or die(mysql_error());
$row_TerminalList mysql_fetch_assoc($TerminalList);

if (isset(
$_GET['totalRows_TerminalList'])) {
  
$totalRows_TerminalList $_GET['totalRows_TerminalList'];
} else {
  
$all_TerminalList mysql_query($query_TerminalList);
  
$totalRows_TerminalList mysql_num_rows($all_TerminalList);
}
$totalPages_TerminalList ceil($totalRows_TerminalList/$maxRows_TerminalList)-1;

$queryString_TerminalList "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_TerminalList") == false && 
        
stristr($param"totalRows_TerminalList") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_TerminalList "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_TerminalList sprintf("&totalRows_TerminalList=%d%s"$totalRows_TerminalList$queryString_TerminalList);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style type="text/css">
<!--
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; }
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; color: #990000; }
-->
</style>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="2">
  <tr>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Record ID&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Description&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Device Type&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Model No.&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Application&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Dial Up&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Capture Mode&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Communications&nbsp;</td>
    <td bgcolor="#CCCCCC" class="style3">&nbsp;Gateway&nbsp;</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><div align="center"><a href="results2.php?recordID=<?php echo $row_TerminalList['uid']; ?>" class="style3"> <?php echo $row_TerminalList['uid']; ?>&nbsp; </a> </div></td>
      <td class="style3"><?php echo $row_TerminalList['ttDynmcDesc']; ?>&nbsp; </td>
      <td class="style3"><?php echo $row_TerminalList['ttDevType']; ?>&nbsp; </td>
      <td class="style3"><?php echo $row_TerminalList['ttDevMod']; ?>&nbsp; </td>
      <td class="style3"><?php echo $row_TerminalList['ttDevAppType']; ?>&nbsp; </td>
      <td class="style3">
      <?php 
              
if ($row_TerminalList['ttDialUp'] == "Y") {
                echo 
"YES";
                } elseif (
$row_TerminalList['ttDialUp'] == "N") {
                    echo 
"NO";
                    } 
                    
?>&nbsp; </td>
      <td class="style3">
      <?php 
              
if ($row_TerminalList['ttCaptMode'] == "T") {
                echo 
"TERMINAL";
                } elseif (
$row_TerminalList['ttCaptMode'] == "H") {
                    echo 
"HOST"
                    }
                    
?>&nbsp; </td>
      <td class="style3"><?php echo $row_TerminalList['ttDevCommFmt']; ?>&nbsp; </td>
      <td class="style3"><?php echo $row_TerminalList['ttGateWay']; ?>&nbsp; </td>
    </tr>
    <?php } while ($row_TerminalList mysql_fetch_assoc($TerminalList)); ?>
</table>
<br />
<table border="0">
  <tr>
    <td class="style3"><?php if ($pageNum_TerminalList 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_TerminalList=%d%s"$currentPage0$queryString_TerminalList); ?>">First</a>
          <?php // Show if not first page ?>    </td>
    <td class="style3"><?php if ($pageNum_TerminalList 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_TerminalList=%d%s"$currentPagemax(0$pageNum_TerminalList 1), $queryString_TerminalList); ?>">Previous</a>
          <?php // Show if not first page ?>    </td>
    <td class="style3"><?php if ($pageNum_TerminalList $totalPages_TerminalList) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_TerminalList=%d%s"$currentPagemin($totalPages_TerminalList$pageNum_TerminalList 1), $queryString_TerminalList); ?>">Next</a>
          <?php // Show if not last page ?>    </td>
    <td class="style3"><?php if ($pageNum_TerminalList $totalPages_TerminalList) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_TerminalList=%d%s"$currentPage$totalPages_TerminalList$queryString_TerminalList); ?>">Last</a>
          <?php // Show if not last page ?>    </td>
  </tr>
</table>
<span class="style5">Records <?php echo ($startRow_TerminalList 1?> to <?php echo min($startRow_TerminalList $maxRows_TerminalList$totalRows_TerminalList?> of <?php echo $totalRows_TerminalList ?></span>
</body>
</html>
<?php
mysql_free_result
($TerminalList);
?>
Danka
frosty is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:20 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design