Jump to content

PHP Query distribute to HTML Table


cjbeck71081

Recommended Posts

I have a Database that has 4 Entries with 3 Peices of information for each entry. All text, one is a description of the property and two are web addresses pointing to the pictures associated with the properties.  I.E.  112 State Street, http://www.server.com/pic1.jpg, http://www.server.com/pic2.jpg;

I would like to set up an HTML table with PHP that will Populate the first column of the HTML table with the name of the property, and then pass the web addresses to insert a picture in each of the next two columns.

Here is a webaddress that shows my code working on one item, i just cannot get it to array this for the 4 entries i have

http://www.epicri.com/bdd/form.php

here is the code i used to create this, perhaps someone can tell me what kind of array i would need to continue to build onto the HTML with the other 4 entries i have.

[code]<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
-->
</style>
</head>

<?php

$hostname = "xxxxxx";
$username = "xxxxxx";
$password = "xxxxxx";
$usertable = "bddtable";
$dbName = "epicr001";
$propname = $_POST['propname'];

?>

<?php

$con = mysql_connect($hostname,$username,$password);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db($dbName, $con);

$result = mysql_query("SELECT * FROM $usertable");

$row = mysql_fetch_array($result);

$test = $row['propname'];
$beforepic = $row['beforepic'];
$afterpic = $row['afterpic'];

?>





<body>
<table width="317" border="0" cellpadding="0">
  <tr>
    <td height="35" colspan="2"><p align="center" class="style1"><?=$test?></p>    </td>
  </tr>
  <tr>
    <td width="164" height="161"><img src="<?=$beforepic?>" border="0" /></a></td>
    <td width="147"><img src="<?=$afterpic?>" /></td>
  </tr>
</table>
</body>
</html>
[/code]

Thanks for the help
Chris



[size=14pt][u][i][b]I figured this out and have posted a new question[/b][/i][/u][/size]

Link to comment
https://forums.phpfreaks.com/topic/31375-php-query-distribute-to-html-table/
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.