View Single Post
Old 11-27-2008, 11:42 PM   #8 (permalink)
zxt3st
The Addict
 
zxt3st's Avatar
 
Join Date: Apr 2008
Posts: 200
Thanks: 18
zxt3st is on a distinguished road
Default

Updates:

sample_db.php

PHP Code:
<?php

class DBMysql
{
    var 
$query;
    
    
/* public function __construct($db_host, $db_user, $db_pass)
    {
        $this->dbhost = $db_host;
        $this->dbuser = $db_user;
        $this->dbpass = $db_pass;
    } */
    
    
public function do_connect($db_host$db_user$db_pass)
    {
        
$dblink = @mysql_connect($this->$db_host$this->$db_user$this->$db_pass);
        if (
$dblink)
        {
            echo 
"success";
        }
        else
        {
            throw new 
exception('Error connecting to the database!.');
        }
    }
    
    public function 
do_query($dbquery)
    {
        
$result = @mysql_query($this->$dbquery);
        if (
$result)
        {
            echo 
"Successfull!";
        }
        else
        {
            throw new 
exception('Error executing query!.');
        }
        return 
$result;
    }
    
    public function 
disconnect()
    {
        @
mysql_close($this->connection);
    }
}

?>


index.php
PHP Code:
<?php
#error_reporting(E_ALL);
include('sample_db.php');
include(
'dbconfig.php');

$db = new DBMysql();

$connection $db->do_connect($at_Mhost$at_Muser$at_Mpass);
$sql "create table aldin";
$query $db->do_query($sql);

?>
dbconfig.php
Code:
nothing change
I have modified a little on the codes just to see if my class are working well. And now as what you can see on the query im creating the database, and when i check it there is no error, but still i can't create the table i want.

Im still messing around :) any feedback is greatly appreciated.

Thnx.
__________________
Serenity Project - 5% (Layout) - Ongoing....
Project Serenity Free Life!....
zxt3st is offline  
Reply With Quote