Posts Tagged ‘MySql’

Sometimes we confuse about how to mysql insert into multiple tables at a time ? This so easy just like below the code

INSERT INTO table1(c1, c2, c3), table2(c4, c5, c6) VALUES ('v1', 'v2',
'v3',v4, 'v5', 'v6');

That’s all.

Creating Joomla component called mvc

Posted: November 9, 2010 in Joomla, MySql, PHP
Tags: , ,
Today I shall create component called mvc. The tutorial is discussed below step by step :
  1. Create folder administrator/components/com_mvc.
  2. Create file administrator/components/com_mvc/admin.mvc.php. This is standard Joomla file that will be launched on access to the component.

    File listing: admin.mvc.php

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once (JPATH_COMPONENT.DS.'controller.php');
if($controller = JRequest::getVar('controller')) {
require_once (JPATH_COMPONENT.DS.'controllers'.
DS.$controller.'.php');
}
$classname = 'MvcController'.
ucfirst($controller);
$controller = new $classname( );
$controller->execute( JRequest::getVar('task'));
$controller->redirect();
?>

(more…)

PHP Project-5: Counter script tutorial

Posted: November 7, 2010 in MySql, PHP
Tags: ,

In this tutorial create 1 file
1. counter.php

Step
1. Create table “counter” in database “test”.
2. Create file counter.php.

1. Create table “counter”

CREATE TABLE `counter` (
`counter` int(9) NOT NULL default '0'
) TYPE=MyISAM;

(more…)

PHP Project-4 :PHP User online tutorial

Posted: November 7, 2010 in MySql, PHP
Tags: ,

In this tutorial create 1 file
1. user_online.php

Step
1. Create table “user_online” in mysql in database “test”.
2. Create file user_online.php.

1. Create table “user_online”

CREATE TABLE `user_online` (
`session` char(100) NOT NULL default '',
`time` int(11) NOT NULL default '0'
) TYPE=MyISAM;


(more…)

PHP Project-3 :PHP Login script tutorial

Posted: November 7, 2010 in MySql, PHP
Tags: ,

In this tutorial create 3 files
1. main_login.php
2. checklogin.php
3. login_success.php

Step
1. Create table “members” in database “test”.
2. Create file main_login.php.
3. Create file checklogin.php.
4. Create file login_success.php.
5. Create file logout.php

1. Create table “members”

CREATE TABLE `members` (
`id` int(4) NOT NULL  auto_increment,
`username` varchar(65)  NOT NULL default '',
`password` varchar(65)  NOT NULL default '',
PRIMARY KEY  (`id`)
) TYPE=MyISAM  AUTO_INCREMENT=2 ;

--
-- Dumping data for  table `members`
--

INSERT  INTO `members` VALUES (1, 'john', '1234');

(more…)