evenmonkeys
08-10-2005, 05:39 AM
I'm not really sure how to describe what I am looking for. I learned that what I had tried to do was not possible. Basically, I tried to use php within a vbphrase and within a template. Turns out I can't do that. I'm looking for a way that I can easily specify what I would like to pull from the database. Specify a table, the fields, and all that fun stuff. Think someone can think something up?
Here's an example of what I tried to do...
<table align="center" border="1" cellspacing="1" cellpadding="1">
<?PHP
$dbhost = 'localhost';
$dbuser = '';
$dbuserpassword = '';
$dbname = '';
$tablename = '';
$conn = mysql_connect("$dbhost", "$dbuser", "$dbuserpassword")
or die(mysql_error());
mysql_select_db("$dbname",$conn) or die(mysql_error());
$result = mysql_query("SELECT * FROM $tablename");
while($query_data = mysql_fetch_row($result)) {
echo "<tr><td width=125>", $query_data[1],"</td>";
echo "<td>", $query_data[4],"</td></tr>";
echo "<tr><td colspan=2>", $query_data[2],"</td></tr>";
echo "<tr><td colspan=2>", $query_data[3],"</td></tr>";
}
?>
</table>
This obviously doesn't work... so if you have a way to help me, please let me know. This would be a good hack. ^^
Here's an example of what I tried to do...
<table align="center" border="1" cellspacing="1" cellpadding="1">
<?PHP
$dbhost = 'localhost';
$dbuser = '';
$dbuserpassword = '';
$dbname = '';
$tablename = '';
$conn = mysql_connect("$dbhost", "$dbuser", "$dbuserpassword")
or die(mysql_error());
mysql_select_db("$dbname",$conn) or die(mysql_error());
$result = mysql_query("SELECT * FROM $tablename");
while($query_data = mysql_fetch_row($result)) {
echo "<tr><td width=125>", $query_data[1],"</td>";
echo "<td>", $query_data[4],"</td></tr>";
echo "<tr><td colspan=2>", $query_data[2],"</td></tr>";
echo "<tr><td colspan=2>", $query_data[3],"</td></tr>";
}
?>
</table>
This obviously doesn't work... so if you have a way to help me, please let me know. This would be a good hack. ^^