- My Goal - learn how to write and use event functions in jQuery.
- My immediate problem - figure out how to include SQL queries in jQuery functions.
Code: Select all
<?php
/*
In this class we instantiate an SQL Connection object. Connection details are assinged to
object variabes so that they can be used when connecting to the database. The two main
functions are conn() and disc(). They are for connecting and disconnecting to the SQL database.
*/
class doConnect
{
private $databasehost;
private $databasename;
private $databaseusername;
private $databasepassword;
function __construct()
{
$this->setRes();
$this->conn();
}
function setRes()
{
$this->databasehost = "localhost";
$this->databasename = "vehicles";
$this->databaseusername ="cars";
$this->databasepassword = "car123";
}
function conn()
{
$con = @mysql_connect($this->databasehost,$this->databaseusername,$this->databasepassword) or die(mysql_error());
@mysql_select_db($this->databasename) or die(mysql_error());
}
function disc()
{
mysql_close();
}
}
?>But, unless someone can convince me there is a better way, I feel a strong need to learn about event functions. In writing classical databases I use event procedures constantly. They make it possible to create a user-friendly database - with a lot of code action happening on AfterUpdate, OnClick, OnClose, OnOpen, BeforeUpdate. The users don't even know what is happening, data just appears at important points in the process (cascading lists for example) with no effort on their part. As of yet, I've not found anything similar in php. So... jquery seems to be a necessary learning curve.
Any help or advice is appreciated.
Thanks Much - Pavilion