| | |
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 |
.htaccess ajax alerts apache api array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email emptydisplayvalue error errors explodefunction file files folder form forms function functions google hack href htaccess html htmlspecialchars image include insert integration ip java javascript joomla keywords limit link login loop mail menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect regex remote script search securephp server sessions shot sms soap source space sql subscription syntax system table tutorial update upload url validator variable video web xml youtube





