troubleshooting Question

How can i implement my own mysql query into an JOOMLA 2.5 page

Avatar of Solenthaler
Solenthaler asked on
MySQL ServerAJAXPHP
4 Comments1 Solution1615 ViewsLast Modified:
Must implement the following mySQL query-code into an Joomla Article:
-----------------------------------------------------------------------------------------
Here is my code example (the complete code is attached) this is the ->index.php

<?php
  include('db.php');
  include('func.php');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chained Select Boxes using PHP, MySQL and jQuery</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
      $('#wait_1').hide();
      $('#drop_1').change(function(){
        $('#wait_1').show();
        $('#result_1').hide();
      $.get("func.php", {
            func: "drop_1",
            drop_var: $('#drop_1').val()
      }, function(response){
        $('#result_1').fadeOut();
        setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400);
      });
          return false;
      });
});

function finishAjax(id, response) {
  $('#wait_1').hide();
  $('#'+id).html(unescape(response));
  $('#'+id).fadeIn();
}
</script>
</head>

<body>
<p>
<form action="" method="post">
 
    <select name="drop_1" id="drop_1">
   
      <option value="" selected="selected" disabled="disabled">Select a Category</option>
     
      <?php getTierOne(); ?>
   
    </select>
   
    <span id="wait_1" style="display: none;">
    <img alt="Please Wait" src="ajax-loader.gif"/>
    </span>
    <span id="result_1" style="display: none;"></span>
 
</form>
</p>
<p>
<?php if(isset($_POST['submit'])){
      $drop = $_POST['drop_1'];
      $tier_two = $_POST['tier_two'];
      echo "You selected ";
      echo $drop." & ".$tier_two;
}
?>
<p><a href="three-tier/">View 3 Tier Select Box Example</a></p>
</body>
</html>
---------------------------------------------------------------------------------------
Is there an elegant way. I did never implement own DB Queries into Joomla.
The DB-Part is a new table in Joomlas Main DB.
1. How is the connection to the table done?
2. Is there an other issue with the DB?
3. Where must the PHP-Code be implemented?
Regards
Roland
index.php
func.php
db.php
ASKER CERTIFIED SOLUTION
Member_5340450

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros