Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating question

Status
Not open for further replies.

padaman420

Programmer
Jan 24, 2006
15
CA
Mys question is the following

I created a table wich is used to post my query result.

what do I have to do if a want my site to generate a new table for each record set in my database ???

thanks in advance for your time and help



 
What do you mean by a "record set"? A record set is usually considered one or more records from a database table, which mines one HTML table could be used to handle the output of the entire datbase table.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
ok i'll try another way

Instead of of having all the records showing up in the same table, i would like them to show up in different tables with the same table design.

If I have one record well the result would be one table with the info, if there's 2 records, well they would be 2 tables etc etc.

I don't know how else I could explain this.

Here's the code for my table

I buted the field names of my DB table between [ ] and the come from a : interview_list .

------------------------------------------------------------
<table width="326" height="100%" border="0" cellpadding="0" cellspacing="0" background="../images/rep_5.jpg">
<tr>
<td height="22" align="left" valign="top" background="../images/obo.jpg"><table width="100%" border="0" cellpadding="00">
<tr>
<td width="6%">&nbsp;</td>
<td width="67%">[artist]</td>
<td width="27%"><div align="right">[date]</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="100%" align="left" valign="top" style="background-repeat:no-repeat; background-position:bottom left "><div style="padding-left:8px; padding-top:5px; padding-right:12px; padding-bottom:10px">
<table width="100%" border="0" align="center" cellpadding="00">
<tr>
<td width="28%" rowspan="3">[image]</td>
<td width="72%">&nbsp;</td>
</tr>
<tr>
<td>[intro]</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<div align="center"></div>
</div></td>
</tr>
<tr>
<td height="18" align="left" valign="top" background="../images/bot_4.jpg"><div style="padding-left:257px; padding-top:0px"><a href="#" class="style12" style="text-decoration:none ">more info</a></div></td>
</tr>
</table>
------------------------------------------------------------

Now I want each record to show up in a different table like the one we see here.

Any one can help.
 
Oh! You want each record in a recordset in its own table.

Your script should fetch a handle to record set then loop through the records in the set using a while() loop.

Inside that while loop, the script should output whatever HTML you need to make the data appear inside a table. It'll be something of the form:

NOTE. THIS IS NOT WORKING PHP CODE.

while ($somearray = fetch_record($record_handle)
{
print '<table...><tr....>';
print '<td>' . $somearray['some element'] . '</table>';
}

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Would this be ok for my needs ????

-----------------------------------------------------------


mysql_connect("localhost","******","*******");
mysql_select_db($database_indamix, $indamix);
$query_interview_list = "SELECT artist, intro, image, `date`, col FROM interviews";
while($r=mysql_fetch_array($result)) loop
{
print '<table width=\"326\" height=\"100%\" border\"0\" cellpadding=\"0\" cellspacing=\"0" background=\"../images/rep_5.jpg">;
"<tr>";
"<td height=\"22\" align=\"left\" valign=\"top"\ background=\"../images/obo.jpg"><table width=\"100%\" border=\"0\" cellpadding=\"00">";
"<tr>";
"<td width=\"6%\">&nbsp;</td>
"<td width=\"67%\"> . $interview_list['artist']. </td>";
"<td width="\27%\"><div align=\"right\"> . $interview_list['date'] . </div></td>";
"</tr>";
"</table></td>";
"</tr>";
"<tr>";
"<td height=\"100%\" align=\"left\" valign=\"top\" style=\"background-repeat:no-repeat; background-position:bottom left\"><div style=\"padding-left:8px; padding-top:5px; padding-right:12px; padding-bottom:10px\">";
"<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"00\">;"
"<tr>";
"<td width=\"28%\" rowspan=\"3\"> . $interview_list['image'] . </td>";
"<td width=\"72%\">&nbsp;</td>";
"</tr>";
"<tr>";
"<td> . $interview_list['intro'] .</td>";
"</tr>";
"<tr>";
"<td>&nbsp;</td>";
"</tr>";
"</table>";
"<div align=\"center\"></div>";
"</div></td>";
"</tr>";
"<tr>";
<td height=\"18\" align=\"left\" valign=\"top\" background=\"../images/bot_4.jpg\"><div style=\"padding-left:257px; padding-top:0px\"><a href="../interviews/interview.php?<?php echo $row_interview_list['artist']; ?>"class=\"style12\" style=\"text-decoration:none\">more info</a></div></td>";
"</tr>";
"</table>";';
}

------------------------------------------------------------

Thanks for your help
 
I' actually getting an error on this line

"<td width=\"67%\"> . $interview_list['artist'] . </td>";


and it gives me a " PARSE " error ??



 
You did not close the line before this one:
Code:
"<td width=\"6%\">&nbsp;</td>[red]";[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top