Welcome to the WebHostingTalk! This should be in the programming discussion forum, its not a tutorial! Anyway, here goes:
PHP Code:
function get_categories() {
$conn = mysql_connect('', '', '');
$selectDB = mysql_select_db('', $conn);
$result = @mysql_query($query);
if (!$result) {
return false;
}
if (@mysql_num_rows == 0) {
return false;
}
while ($rows = mysql_fetch_array($result)) {
$categories[] = $rows;
}
return $categories;
}
It would be a good idea to set a global connection to the database rather than setting up a new connection in each function that requires a connection. Also you shouldnt use OOP style coding when your doing everything else procedural its bad practise. And try sticking your code in PHP tags when your writing a message!
Try searching on the google for some tutorials and resources and check out
www.phpfreaks.com and www.php.net!
Hope this helps!