Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question need help making functions call other functions

    i have these several functions that i want to be able to call other functions like this.

    Code:
    	function confirm_query($result_set){
    		if(!$result_set){
    			die("Database query failed: ".mysql_error());
    		}	
    	}
    	
    	function bookmarksections(){
    			$bookmarksections = mysql_query("SELECT * FROM bookmarksections");
    			confirm_query($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"]}");
    		confirm_query($bookmarks);
    		return $bookmarks;
    	}
    but when i try to call the functions in my code it doesnt work.. plz help
    -Adam

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •