PHP Classes

how to use the package

Recommend this page to a friend!

      ezSQL  >  All threads  >  how to use the package  >  (Un) Subscribe thread alerts  
Subject:how to use the package
Summary:Problem with Package ez_sql
Messages:2
Author:Kalpesh
Date:2008-07-30 07:39:53
Update:2008-10-24 23:12:38
 

  1. how to use the package   Reply   Report abuse  
Picture of Kalpesh Kalpesh - 2008-07-30 07:39:55
i try to run ez_demo.php but it gives me one notice and one fatal error.

notice is:Undefined variable: db in C:\Program Files\EasyPHP 2.0b1\www\mysqldb-2002-10-15\ez_demo.php on line 7

error:Call to a member function get_results() on a non-object in C:\Program Files\EasyPHP 2.0b1\www\mysqldb-2002-10-15\ez_demo.php on line 7.

i change the setting in ez_sql.php to

define("EZSQL_DB_USER", "root"); // <-- mysql db user
define("EZSQL_DB_PASSWORD", ""); // <-- mysql db password
define("EZSQL_DB_NAME", "test"); // <-- mysql db pname
define("EZSQL_DB_HOST", "localhost"); // <-- mysql server host

please help me



  2. Re: how to use the package   Reply   Report abuse  
Picture of mang mang - 2008-10-24 23:12:38 - In reply to message 1 from Kalpesh
dont modify the file directly, change the setting on demo.php
or include a file where the settings are modified
example:

demo.php

// Include ezSQL core
include_once "../shared/ez_sql_core.php";

// Include ezSQL database specific component
include_once "ez_sql_mysql.php";

// Initialise database object and establish a connection
// at the same time - db_user / db_password / db_name / db_host
$db = new ezSQL_mysql('root','pwd','database','localhost');

/**********************************************************************
* ezSQL demo for mySQL database
*/

// Demo of getting a single variable from the db
// (and using abstracted function sysdate)
$current_time = $db->get_var("SELECT " . $db->sysdate());
print "ezSQL demo for mySQL database run @ $current_time";

that should work