| | |
Problem in displaying data from DB
![]() |
•
•
Join Date: May 2008
Posts: 90
Reputation:
Solved Threads: 0
Hi,
I wanted to display data which is in my db.The format of displaying must be in a div, in that div 3 columns & each column must have 10 rows.Am using this:
which is displaying it in a single line. I used even for loop which is displaying again in the single line.What way can be used to print in the above format?
I wanted to display data which is in my db.The format of displaying must be in a div, in that div 3 columns & each column must have 10 rows.Am using this:
PHP Syntax (Toggle Plain Text)
while($data = mysql_fetch_array($result)) { echo $query; echo ' <tr> <td colspan="3" > <a href="'.$data['MedName'].'" >' . $data['dispname'].' </a> </td>'; echo'</tr>'; }
Suhasini
here is something i typed up a few weeks ago. it should work.
PHP Syntax (Toggle Plain Text)
$table = '<table id="module" class="module" border="0" cellspacing="0" cellpadding="5">'; $cols = 3; $per_column = 10; $col = 1; $table .= '<tr>'; $table .= '<td>'; $table .= '<table id="module" class="module" border="0" cellspacing="0" cellpadding="5">'; $i = 0; while ($row = $p->fetchAssoc($query)) { $table .= '<tr>'; $table .= '<td><a href="' . $row['MedName'] . '">' . $row['dispname'] . '</a></td>'; $table .= '</tr>'; if ($i == ($per_column*$col)) { $table .= '</table>'; $table .= '</td>'; $table .= '<td>'; $table .= '<table id="module" class="module" border="0" cellspacing="0" cellpadding="5">'; $col++; } $i++; } $table .= '</table>'; $table .= '</td>'; $table .= '</tr>'; $table .= '</table>'; echo $table;
Last edited by kkeith29; Jun 4th, 2008 at 3:30 am.
•
•
Join Date: May 2008
Posts: 90
Reputation:
Solved Threads: 0
what is $p here
PHP Syntax (Toggle Plain Text)
while ($row = $p->fetchAssoc($query))
Suhasini
•
•
Join Date: May 2008
Posts: 90
Reputation:
Solved Threads: 0
Its Working.But have small problem, I have 4 buttons Home Categories Brand Store in a row.When I click each button the text display.Here if catogery is clicked that is in the same row but remaining 3 buttons are moving down.when it is clicked again..they are going back to normal position.Why is it like that?
Suhasini
![]() |
Similar Threads
- Winsock C++ help: receiving data (C++)
- Data from mysql in a 3 columns table (PHP)
- Help me about JSP problem... (JSP)
- Hash Table display problem (C++)
- Cartesian Product Problem (Oracle)
- problem in VB.NET? (VB.NET)
- Problem with displaying data.. (PHP)
- Displaying Data in C programmming (C)
Other Threads in the PHP Forum
- Previous Thread: Sending data to a form using hyperlink
- Next Thread: Display forms results
Views: 517 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for PHP
access ajax apache array beginner box broken buttons cakephp check checkbox class cms code cookies database date directory display download dropdown drupal dynamic echo email error file files folder form forms function functions header hosting href htaccess html image images include insert ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql order parse password paypal php problem query radio random redirect regex remote results script search security select server session sessions shopping soap sort sorting source sql string system table unicode update upload url user validation variable video web website wordpress xml






