Shamrox Posted September 18, 2007 Share Posted September 18, 2007 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. Quote Link to comment Share on other sites More sharing options...
freakstyle Posted September 18, 2007 Share Posted September 18, 2007 it'll help if provide code examples. if you are asking how to use the data from a db elsewhere: <?php $YourVar = $row['some_colum_in_db'] ; // then you can echo $YourVar elsewhere on the page good luck Quote Link to comment Share on other sites More sharing options...
Shamrox Posted September 18, 2007 Author Share Posted September 18, 2007 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. Quote Link to comment Share on other sites More sharing options...
Shamrox Posted September 18, 2007 Author Share Posted September 18, 2007 Ok, i thought i had it, but i don't. Quote Link to comment Share on other sites More sharing options...
Shamrox Posted September 18, 2007 Author Share Posted September 18, 2007 Need to find specific row and specific columns... Quote Link to comment Share on other sites More sharing options...
AdRock Posted September 18, 2007 Share Posted September 18, 2007 Sounds like you need to use LIMIT to specify how many are listed and maybe use a WHERE clause too Quote Link to comment Share on other sites More sharing options...
Shamrox Posted September 19, 2007 Author Share Posted September 19, 2007 i was trying to use one query for both outputs. I can't use LIMIT because I need all the contacts for the listing. but i need to extract 1-3 for a sep list. any ways to do this w/o creating a second query? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.