Jump to content

Output specific row data


Shamrox

Recommended Posts

I've got a standard web page outputting data about a client. one side lists all the contacts for the company that I'm doing with a standard repeat region.

I'd like to output a specific row to a different section of the  page, but not sure how to call a specific row (i.e.  row 1,2 and 3)

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/69789-output-specific-row-data/
Share on other sites

Right now I have

 

Query:

$colname_rs_contactdis = "-1";
if (isset($_GET['clientid'])) {
  $colname_rs_contactdis = $_GET['clientid'];
}
mysql_select_db($database_spectrum, $spectrum);
$query_rs_contactdis = sprintf("SELECT * FROM spec_contacts WHERE companyid = %s ORDER BY `level` ASC", GetSQLValueString($colname_rs_contactdis, "int"));
$rs_contactdis = mysql_query($query_rs_contactdis, $spectrum) or die(mysql_error());
$row_rs_contactdis = mysql_fetch_assoc($rs_contactdis);
$totalRows_rs_contactdis = mysql_num_rows($rs_contactdis);

$colname_rs_clientdis = "-1";
if (isset($_GET['clientid'])) {
  $colname_rs_clientdis = $_GET['clientid'];
}

 

<?php do { ?>
      <table width='100%' border='0' id="contacttable"> 
        <tr>
            <td nowrap='nowrap'> </td>                </tr>
        <tr>
          <td nowrap='nowrap'><?php echo $row_rs_contactdis['firstname']; ?> <?php echo $row_rs_contactdis['lastname']; ?></td>		
            </tr>
        <tr>
          <td nowrap='nowrap'>P: <?php echo $row_rs_contactdis['phone']; ?>  Ext <?php echo $row_rs_contactdis['extension']; ?></td>		
            </tr>
        <tr>
          <td nowrap='nowrap'>F: <?php echo $row_rs_contactdis['fax']; ?></td>                
            </tr>
        <tr>
          <td nowrap='nowrap'><?php echo $row_rs_contactdis['email']; ?></td>                
            </tr>
        <tr>
          <td nowrap='nowrap'><?php echo $row_rs_contactdis['address1']; ?></td>                
            </tr>
        <tr>
          <td nowrap='nowrap'><?php echo $row_rs_contactdis['address2']; ?></td>                
            </tr>
        <tr>
          <td nowrap='nowrap'><?php echo $row_rs_contactdis['city']; ?>, <?php echo $row_rs_contactdis['state']; ?> <?php echo $row_rs_contactdis['zip']; ?></td>                
            </tr>
        </table>
                <?php } while ($row_rs_contactdis = mysql_fetch_assoc($rs_contactdis)); ?>	

 

This is what displays all the contacts for a given client.

I want to now take just the first, second and third contact and display the name elsewhere on the page. Not sure how to extract just those rows.

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.