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 3 of 3

Thread: Fatal Error

  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    78
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Fatal Error

    Okay so i have a "home page" being populated with data from a database inside a form table. I have added checkboxes to allow the user to check which recipe he/she wants to view. or the user can select (check) more than one recipe and then another page will open and display the data for the recipe or recipes the user (checked)


    Here is the code i am using after the user has checked and hit the submit button displaying the data on another page.
    Code:
    <?
    
    	$db = mysql_connect( "localhost","root", "temp1234");
    	mysql_select_db( "Peters_restaurantDB");
    
    	$id = $_GET['r_name[]'];
    
    	
    $sql = "
        SELECT id, name, description, preptime, totaltime, rating
        FROM recipes
        WHERE id IN (" . implode( ",", $_GET("r_name[]") ) . ");
    ";
    Right now i am getting this error:

    Fatal error: Function name must be a string in /var/ShoppingList.php on line 21

    The line with the "WHERE id IN"
    Can someone please tell me what i am doing wrong or leaving out?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,633 Times in 4,595 Posts
    *PLEASE* don't start a new thread with the SAME CONTENT as an existing one!
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Try
    PHP Code:
    $sql ="SELECT id, name, description, preptime, totaltime, rating
        FROM recipes
        WHERE id IN (" 
    implode","$_GET["r_name"] ) . "); "
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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