| | |
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 |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl customizableitems database date directory display download dynamic echo email error file files folder form format forms forum function functions gc_maxlifetime google headmethod href htaccess html image include insert integration ip java javascript joomla limit link login loop mail malfunctioning menu methods mlm mod_rewrite multiple mysql oop parse parsing paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube





