Hi
Hope somebody can help me.
What I won't is to make table in withc some data will be populated.
table should look like this:
|--------------------------|----------|
|/data1/|/picture1/|/data2/|////////////|
|--------------------------|///////////|
|/data3/|////data4//////////|/picture2//|
|--------------------------|///////////|
|/data5/|////data6///////////|///////////|
|--------------------------|----------|
normaly without "/" letter.
this is my first php creation of table, so please help meso why is the php? all what you want to do so far is regular html. can't you make a table in html?
<table width="100%">
<tr>
<td>/data1/</td>
<td>/picture1/</td>
<td>/data2/</td>
<td rowspan="3">/picture2//</td>
</tr>
<tr>
<td>/data3/</td>
<td colspan="2">////data4//////////</td>
</tr>
<tr>
<td>/data5/</td>
<td colspan="2">////data6//////////</td>
</tr>
</table>I need it in PHP becouse I've got to loop search, and fill up data in this table, and table must be created for each result of loop.so, making a table is still html. put it in the loop. but without knowing the code that you are doing I can't help. but I just code you the table so just insert it into the loop. but take the <table> tags out of the loop and just leave the rows.<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
?>
<table width="100%">
<tr>
<td><?=$row["column1"]?></td>
<td><?=$row["column2"]?></td>
<td><?=$row["column3"]?></td>
</tr>
</table>
<?
}
mysql_free_result($result);
?>
or even better.
<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
?>
<table width="100%">
<?
while ($row = mysql_fetch_object($result)) {
?>
<tr>
<td><?=$row["column1"]?></td>
<td><?=$row["column2"]?></td>
<td><?=$row["column3"]?></td>
</tr>
<?
}
?>
</table>
<?
mysql_free_result($result);
?>
this <?=(phpcode)?> is a shorthand way of doing PHP's "echo" command. It comes in handy for not having to do the same example above like this:
<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
echo "<table width=\"100%\">";
echo "<tr>";
echo "<td>".$row["column1"]."</td>";
echo "<td>".$row["column2"]."</td>";
echo "<td>".$row["column3"]."</td>";
echo "</tr>";
echo "</table>";
}
mysql_free_result($result);
?>
-panreachthank you
Hope somebody can help me.
What I won't is to make table in withc some data will be populated.
table should look like this:
|--------------------------|----------|
|/data1/|/picture1/|/data2/|////////////|
|--------------------------|///////////|
|/data3/|////data4//////////|/picture2//|
|--------------------------|///////////|
|/data5/|////data6///////////|///////////|
|--------------------------|----------|
normaly without "/" letter.
this is my first php creation of table, so please help meso why is the php? all what you want to do so far is regular html. can't you make a table in html?
<table width="100%">
<tr>
<td>/data1/</td>
<td>/picture1/</td>
<td>/data2/</td>
<td rowspan="3">/picture2//</td>
</tr>
<tr>
<td>/data3/</td>
<td colspan="2">////data4//////////</td>
</tr>
<tr>
<td>/data5/</td>
<td colspan="2">////data6//////////</td>
</tr>
</table>I need it in PHP becouse I've got to loop search, and fill up data in this table, and table must be created for each result of loop.so, making a table is still html. put it in the loop. but without knowing the code that you are doing I can't help. but I just code you the table so just insert it into the loop. but take the <table> tags out of the loop and just leave the rows.<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
?>
<table width="100%">
<tr>
<td><?=$row["column1"]?></td>
<td><?=$row["column2"]?></td>
<td><?=$row["column3"]?></td>
</tr>
</table>
<?
}
mysql_free_result($result);
?>
or even better.
<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
?>
<table width="100%">
<?
while ($row = mysql_fetch_object($result)) {
?>
<tr>
<td><?=$row["column1"]?></td>
<td><?=$row["column2"]?></td>
<td><?=$row["column3"]?></td>
</tr>
<?
}
?>
</table>
<?
mysql_free_result($result);
?>
this <?=(phpcode)?> is a shorthand way of doing PHP's "echo" command. It comes in handy for not having to do the same example above like this:
<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
echo "<table width=\"100%\">";
echo "<tr>";
echo "<td>".$row["column1"]."</td>";
echo "<td>".$row["column2"]."</td>";
echo "<td>".$row["column3"]."</td>";
echo "</tr>";
echo "</table>";
}
mysql_free_result($result);
?>
-panreachthank you