Jump to content

Displaying Results


tommy445

Recommended Posts

Hello,

 

I am echo'ing specific data form mysql database in a table.

 

<?php echo $row['client_name']; ?>

<?php echo $row['client_date']; ?>

<?php echo $row['client_type']; ?>

<?php echo $row['client_description']; ?>

 

each record is displayed under each other.

 

How do I 1). get the records to display side by side (left to right then under that the 3rd and 4th)

 

and 2) Have the name display only once with the date, type and description for all of the rest.

 

example:

 

John Doe

 

Jan. 5, 2009          Jan. 9, 2009

Phone                    Online

Update DOB            Income verification

 

 

Jan. 12, 2009          Jan. 14, 2009

Online                    Mail

Follow-up              Signatures

 

Thanks

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

A quick and easy way is to use a DIV set to a specific width and in your loop echo out your data inside separate floating DIVs.

 

The CSS:

div#wrapper {
  width: 400px;
}
div#container {
  width: 200px;
  float: left;
}

 

The code:

echo '<div id="wrapper">';
echo $row['client_name'];
$query=mysql_query("SELECT * FROM table");
while ($row=mysql_fetch_assoc($query)) {
  echo '<div id="container">';
  echo $row['client_date'].'<br />';
  echo $row['client_type'].'<br />';
  echo $row['client_description'].'<br />';
  echo '</div>';
}
echo '</div>'; //close the wrapper container

 

Something like that.

Link to comment
https://forums.phpfreaks.com/topic/150373-displaying-results/#findComment-789698
Share on other sites

This is only returning one record.  What am I doing wrong?  thanks

 

<?php

echo '<div id="wrapper">';

echo $row['client_name'];

$sel= "SELECT * FROM select * from site_clients as t2

        left join site_calls as t1 on t2.client_id = t1.service_contact_data

where t2.client_id='".$_POST['client_id']."'";

while ($row=mysql_fetch_assoc($run)) {

  echo '<div id="container">';

    echo $row['client_account_number'].'<br />';

$service_date = $row ['service_date']; echo date('F d, Y', $service_date).'<br />';

  echo $row['service_name'].'<br />';

  echo $row['service_type'].'<br />';

  echo $row['service_description'].'<br />';

  echo '</div>';

}

echo '</div>'; //close the wrapper container

?>

 

Link to comment
https://forums.phpfreaks.com/topic/150373-displaying-results/#findComment-789882
Share on other sites

does your:

$sel= "SELECT * FROM select * from site_clients as t2
           left join site_calls as t1 on t2.client_id = t1.service_contact_data
         where t2.client_id='".$_POST['client_id']."'";

 

return all your records without Yesideez  suggestion?

 

Because if it did then you have a problem with your query statement. 

Link to comment
https://forums.phpfreaks.com/topic/150373-displaying-results/#findComment-789918
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.