| | |
Connecting to a mysql database through a class
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I have done this a million times before.
I dont understand why this is not working through the use of a class.
It is telling me that the variable is "undefined" hence contains a NULL value which is a load of *((^&$#.
Anyways my code(sections of it) is below, any help much appreciated.
Obviously the initialization statement is in a method which is called via the constructor. Now something is wrong when it plan as day that con is being given a value, I dont understand why it saying it is not. Anyways any idea where to look and how to fix much appreciated.
Thanks, Regards X
I dont understand why this is not working through the use of a class.
It is telling me that the variable is "undefined" hence contains a NULL value which is a load of *((^&$#.
Anyways my code(sections of it) is below, any help much appreciated.
php Syntax (Toggle Plain Text)
private con; $this->con = mysql_connect(server, name, pass);
Obviously the initialization statement is in a method which is called via the constructor. Now something is wrong when it plan as day that con is being given a value, I dont understand why it saying it is not. Anyways any idea where to look and how to fix much appreciated.
Thanks, Regards X
"You never stop learning." - OmniX
0
#2 Oct 6th, 2009
ps:
PHP Syntax (Toggle Plain Text)
private $con;
"You never stop learning." - OmniX
•
•
Join Date: May 2008
Posts: 97
Reputation:
Solved Threads: 16
1
#3 Oct 6th, 2009
How about adding a die statement to assist in debugging like so
happy times!
php Syntax (Toggle Plain Text)
$this->con=mysql_connect($server,$name,$pass) or die(mysql_error());
happy times!
Catch me here!
![]() |
Similar Threads
- Connecting to MySQL database- Run-time error 3001 (Visual Basic 4 / 5 / 6)
- facing problem in database connectivity in java to mysql (Java)
- Need Help in Connecting MySQL Database to JTable (Java)
- Problem while connecting MySQL database through ODBC (C#)
- Problems connecting jsp with MySQL database (JSP)
- can i use mysql database with asp (ASP)
- connecting java to mysql database (Java)
- copying mssql database on my local machine to a mysql database online (MySQL)
Other Threads in the PHP Forum
- Previous Thread: php gd functions are missing
- Next Thread: Interactive Timetable - Assign timeslots
| Thread Tools | Search this Thread |
# 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail memberships menu mlm multiple multipletables mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote rss script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validator variable video web xml youtube





