Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Moderated Pro PHP
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Moderated Pro PHP This is a moderated forum for discussing advanced, professional level issues with PHP. Your posts will not appear until a moderator approves them. Posts that are not the right level for this forum will be responded to and you'll be asked to post them in the [url="http://p2p.wrox.com/sql-server-2000-20/9"]Beginning PHP[/url] forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Moderated Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 13th, 2008, 01:41 AM
Posts: n/a
Default Use my sql instead of postgreSql

i want to use mysql instade of postgreSql.

I use example in professional PHP5 example but i got error. The code is below:
class widget{
    private $id;
    private $name;
    private $description;
    private $cdb;
    private $hdb;
    private $needUpdating=false;

    public function __construct($widgetid)
        //widgetid is the primary key of the record of database containing information for this object
        //Create connection for database


    $this->cdb=mysql_connect("localhost","rabby@localhost" , "rabby",1,1);
    if(!is_resource($this->cdb)) {
    throw new Exception("An Error occurred connecting to mysql");


         $this->hdb=mysql_select_db('parts') ;
            throw new Exception("An Error occurred connecting to database ");

        $sql="SELECT * FROM `widget` where widgetid = $widgetid";
            throw new Exception("An Error occurred selecting from database ");
            throw new Exception("The specified widget does not exit");

    public function __destruct()
        return ;

    $sql="UPDATE `widget` SET `name` = '$this->name',
`description` = '$this->description' WHERE `widgetid` ='$this->id' LIMIT 1 ";

        throw new Exception("An error occure updating the table");
    function sayHellow(){
        print "Hellow {$this->getName()}";

    public function getName()
        return $this->name;
    public function getDescription()
        return $this->description;
    public function setName($name)

    public function setDescription($description)


Reply With Quote
  #2 (permalink)  
Old December 23rd, 2008, 09:14 PM
Authorized User
Join Date: Dec 2008
Location: London
Posts: 50
Thanks: 1
Thanked 5 Times in 5 Posts

can you please post the actuall error message ?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
php and postgresql crmpicco PHP Databases 0 February 23rd, 2007 08:34 AM
Postgresql Transactions satyr Pro JSP 0 March 23rd, 2006 08:31 AM
tomcat with postgreSQL alejo_torres BOOK: Professional Apache Tomcat 0 October 14th, 2005 09:15 AM
question regarding PostgreSQL Moharo MySQL 2 September 9th, 2003 02:38 AM
Upgrading Postgresql 7.1.3 to 7.3.3 ganesh15 PHP How-To 1 September 3rd, 2003 11:07 PM

All times are GMT -4. The time now is 02:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.