i want help on exhibiting records using php and mysql. My understanding with is extremely fundamental although i'm able to read and interpret codes properly. Im presently creating a website using joomla because the Content management systems..i want custom code for php to show the records contents on the table during my mysql database.

here's the code..i've provide the correct particulars from the account however i am unable to can get on.

$user_name = "kansai_ksadmin";
$password = "sample123";
$database = "kansai_ksdb";
$server = "localhost";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
  $SQL = "SELECT jos_djcf_categories.name AS category, jos_djcf_items.name AS title, jos_djcf_items.description FROM jos_djcf_categories INNER JOIN jos_djcf_items ON jos_djcf_categories.id = jos_djcf_items.cat_id";
  $result = mysql_query($SQL);
  while ($db_field = mysql_fetch_assoc($result)) {
    print $db_field['category'] . "<BR>";
    print $db_field['title'] . "<BR>";
    print $db_field['description'] . "<BR>";
  }
  mysql_close($db_handle);
}
else {
   print "Database NOT Found ";
   mysql_close($db_handle);
}

here's the mistake

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'kansai_ksadmin'@'localhost' (using password: YES) in /home/kansai/domains/kansaiscene.com/public_html/beta/modules/mod_php/mod_php.php(36) : eval()'d code on line 9

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/kansai/domains/kansaiscene.com/public_html/beta/modules/mod_php/mod_php.php(36) : eval()'d code on line 10
Database NOT Found
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/kansai/domains/kansaiscene.com/public_html/beta/modules/mod_php/mod_php.php(36) : eval()'d code on line 23

I want assist in solving this issue... thanks!

Since you are in Joomla, you need to make the most of their API, which means you will not encounter this type of problems and will also be more effortlessly integrated within the whole framework. In my opinion this works for both 1.5.xx series and 1.6.

$db =& JFactory::getDBO();

$query = "SELECT #_djcf_categories.name AS category, #_djcf_items.name AS title, #_djcf_items.description FROM #_djcf_categories INNER JOIN #_djcf_items ON #_djcf_categories.id = #_djcf_items.cat_id";

$db->setQuery($query);

$rows = $db->loadAssocList();

foreach ($rows as $row)
{
    print $row['category'] . "<BR>";
    print $row['title'] . "<BR>";
    print $row['description'] . "<BR>";
}

Better, duplicate your index.php. From the center of your code( say after $mainframe->triggerEvent('onAfterRoute')) you should use database queries after which exit.

You should use jos_content rather than #__content within the code below. Say your code is known as db.php, just run out of your browser: http://localhost/website/db.php

I am doing such as this:

{
$db =& JFactory::getDBO(); 

#insert the last article and category
$myquery=<<<EOF
insert into #__content SET `title`='Last Forms Article',`alias`='last-forms-article-234',`introtext`='A',id=149999,`state`=0,`sectionid`=0,catid=0;


EOF;


$db->setQuery($myquery);

$db->query() ;

$myquery=<<<EOF

insert INTO #__categories set `section`=42,`id`='149999',`alias`='last-forms-category-234',`published`='0',`title`='Last Category';

EOF;

$db->setQuery($myquery);
$db->query() ;
//Abort if id 149999 does not exist in both category and article table

$myquery=<<<EOF

select * from #__content,#__categories where #__content.id='149999' and #__categories.id='149999';
EOF;

$db->setQuery($myquery);

if($db->query() ==FALSE ||   $db->getNumRows()!=1)
{
    die ("Last article and category could not be insertted!");
}

....