learning_brain
New Member
- Messages
- 206
- Reaction score
- 1
- Points
- 0
Am I being stupid here or can you not connect to a database within a class in the same way as procedural php????
I get
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home2/qualit94/public_html/test.php on line ..........
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home2/qualit94/public_html/test.php on line ...........
I can get round this problem by directly entering the login details but.... not really sure I want to do that as this will be a commercially available class referencing back to the same db.
I'm very new to classes so go easy on me!
PHP:
class imageAnalysis {
var $whatever = ........... etc.
function imageAnalysis (){//constructor
}
function imageAnalysis (){
//main class structure...
require_once('http://www.qualityimagesearch.com/Connections/discountdomains.php');
mysql_select_db($database_discountdomains, $discountdomains);
$query_compImage = "SELECT * FROM IMGCOMPS";
$compImage = mysql_query($query_compImage, $discountdomains) or die(mysql_error());
$row_compImage = mysql_fetch_assoc($compImage);
$totalRows_compImage = mysql_num_rows($compImage);
}
}
I get
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home2/qualit94/public_html/test.php on line ..........
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home2/qualit94/public_html/test.php on line ...........
I can get round this problem by directly entering the login details but.... not really sure I want to do that as this will be a commercially available class referencing back to the same db.
I'm very new to classes so go easy on me!
Last edited: