I have a problem regarding my mysql connection. I need to access the connection inside a class. How do I do it? Even if I try to include the connection file, or the connection variable $con0 inside the class, it has no value so I get an error.
Connection.php
<?php
$username = " ";
$password = "";
$hostname = " ";
$con = mysql_connect()
?>
model.php
<?php
include(connection.php);
class model{
function needTheConnection($uid){
$q = "SELECT x from DB.table WHERE id = '" . $uid . "'";
$res = mysql_query($q);
}
}
?>
This gives me the "mysql_query(): supplied argument is not a valid MySQL-Link resource".
What is wrong?
Thanks, tinks