View Full Version : need help making functions call other functions

02-22-2011, 03:18 PM
i have these several functions that i want to be able to call other functions like this.

function confirm_query($result_set){
die("Database query failed: ".mysql_error());

function bookmarksections(){
$bookmarksections = mysql_query("SELECT * FROM bookmarksections");
return $bookmarksections;

function bookmarksection(){
$bookmarksections = bookmarksections();
$bookmarksection = mysql_fetch_array($bookmarksections);
return $bookmarksection;

function bookmarks(){
$bookmarksection = bookmarksection();
$bookmarks = mysql_query("SELECT * FROM bookmarks WHERE SectionID = {$bookmarksection["ID"]}");
return $bookmarks;

but when i try to call the functions in my code it doesnt work.. plz help

02-22-2011, 03:26 PM
Looks like it should work fine to me. Bookmarks will only return a resource though.
Are you calling the bookmarks function from somewhere? I assume your connection is open somewhere; mysql should be a global resource so it will find whatever open connection you have regardless of scope.
Can you be more specific by doesn't work?