Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Inserting data into database is not working in joomla 2.5

$
0
0
Dear Folks, I've tried a lots of method to insert my data into joomla database but it's not working. Below is my code:-

<?php
/**
 *
 * @file        $Id: default.php 0.0.2 2012-12-28 00:00:00 Joydeep Banerjee $
 * @package	    School Mangement System 
 * @version     0.0.2
 * @description Simple School Management System component for joomla 2.5
 * @copyright	  Copyright © 2012 - All rights reserved.
 * @license		  GNU General Public License v2.0
 * @author		  Joydeep Banerjee
 * @author mail	joy@vividtechno.com
 * @website		  http://www.indiawebsitedesigndevelopment.com
 *
 **/

  // No direct access
  defined( '_JEXEC' ) or die( 'Restricted access' );
       $app =& JFactory::getDocument();
       $page_title = $app->getTitle();
       $db =& JFactory::getDBO();
        $name = $_POST['name'];
       $class = $_POST['class'];
       
       
       $db =& JFactory::getDBO();
$query = "INSERT INTO `#__jd` (`id`,name`, `class`)
    VALUES ('',$name, $class);";
$db->setQuery( $query );
$db->query(); 
       
       
       
      
         
	// YOUR CUSTOM CODE HERE

?>
<form action="index.php" method="post" name="adminForm">
<input type="hidden" name="option" value="com_sms" />
<input type="hidden" name="view" value="Sms" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
Name: <input type="text" name="name">
Class: <input type="text" name="class">
<input type="submit" value="Register" name="register">
</form>



I want to know what is my mistake and how to insert it successfully. Thanks for any kind of help....

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>