I have a custom table in Joomla that I know how to enter data in. My problem is I have no idea how to list all records in the applicable table!

I’ve tried tutorials but something always goes wrong when trying to display data!

Details:
database name: firstdatabase
password: password
host: localhost

table: jos_customform_1

Field Type Collation Extra
cf_idint(11) auto_increment
recordtime text utf8_general_ci
ipaddress text utf8_general_ci
sku longtext utf8_general_ci
Price longtext utf8_general_ci
description longtext utf8_general_ci

I want to be able to list all data the table on a webpage!

Can one of you experts help me here….I’m a techie but not a developer!

Thanks

This will grab all records and output each record inside a paragraph <p> tag:

<?php
$link = mysql_connect(’localhost’, ‘username’, ‘password’) or die(’Cannot connect to db’);
mysql_select_db(’dbname’) or die(’Cannot select db’);

$rs = mysql_query("SELECT * FROM jos_customform_1") or die(’Cannot execute query’);

while($row = mysql_fetch_array($rs)) {
echo "<p>";
foreach($row as $key=>$value) {
echo "<strong>$key: </strong>$value";
}
echo "</p>";
}
?>

TrackBack URI | RSS feed for comments on this post

One Response

  1. dhvrm

    2009 Aug 09 1

    This will grab all records and output each record inside a paragraph <p> tag:

    <?php
    $link = mysql_connect(’localhost’, ‘username’, ‘password’) or die(’Cannot connect to db’);
    mysql_select_db(’dbname’) or die(’Cannot select db’);

    $rs = mysql_query("SELECT * FROM jos_customform_1") or die(’Cannot execute query’);

    while($row = mysql_fetch_array($rs)) {
    echo "<p>";
    foreach($row as $key=>$value) {
    echo "<strong>$key: </strong>$value";
    }
    echo "</p>";
    }
    ?>
    References :


Leave a reply