PDA

View Full Version : Need help turning this php code into a module


Aaron_j
02-25-2006, 05:24 PM
I have the following PHP code that generates a list of my Photopost categories.

I tried using "Add Module" > "Php File" and pointed it to the php file I uploaded to the modules folder but it doesn't display correctly. The code works and displays the list but the module title is at the bottom of the list.

I have read enough here to realize that I need to do more (template?) but I don't understand what to do so I am just posting the code. Maybe someone can give me some guidence here:

<?php

$host = 'localhost'; // Hostname of MySQL server
$dbUser = ''; // Username for MySQL
$dbPass = ''; // Password for user
$dbname = ''; // Database name
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$dbname") or die(mysql_error());
$result = mysql_query("SELECT id,catname FROM pp_categories WHERE id != 1 AND id != 500 ORDER BY catname ASC") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
print '<a href="/photopost53/showgallery.php?cat=' . $row['id'] . '">' . $row['catname'] . '</a><br>';
}

?>

Aaron_j
02-26-2006, 08:06 PM
"Operators are standing by".

;)

Our Sponsors
 

Brian
02-27-2006, 10:14 PM
Try wrapping a <tr><td> and </td></tr> tags around your code.

NemoTech
04-21-2006, 11:56 PM
Thx