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 11 of 11
  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    64
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Function name must be a string

    another stupid fatal error on line three I have no idea why

    PHP Code:
    <?php 

    include "./global.php";

    ?>

  • #2
    New Coder
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    I use this and it works

    PHP Code:
    <?php  

    include_once("/global.php"); 

    ?>
    try it with the brackets and the _once part and see what you get

  • #3
    New Coder
    Join Date
    Aug 2008
    Posts
    64
    Thanks
    11
    Thanked 0 Times in 0 Posts
    I did the same thing on another file and it worked great but not with global.php

  • #4
    New Coder
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    what file did you use? did you save the file in the right place? is that all the code you have on that page?

  • #5
    New Coder
    Join Date
    Aug 2008
    Posts
    64
    Thanks
    11
    Thanked 0 Times in 0 Posts
    http://img357.imageshack.us/my.php?i...icture1zv2.png

    heres an image so you can see globals.php (made new file with an s on the end)

    and index.php at the same time
    Last edited by westes; 11-06-2008 at 01:42 PM.

  • #6
    New Coder
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    hrrmm theres 2 things i can think of that may be causing the error....
    1. theres not meant to be a . infront of globals.php
    2. if saved in a different folder must put foldername/globals.php

    what is the exact error your getting?

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Post whats in global.php please, as well as the error you're receiving.
    What you have here is correct.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #8
    New Coder
    Join Date
    Aug 2008
    Posts
    64
    Thanks
    11
    Thanked 0 Times in 0 Posts
    ok globals.php is this

    PHP Code:
    <?php

    $mysql_connect
    ('localhost''root''root') or die(mysql_error());
    $db mysql_select_db("users"$con);

    ?>
    error is "Fatal error: Function name must be a string in /Applications/MAMP/htdocs/globals.php on line 3"
    Last edited by westes; 11-06-2008 at 11:00 PM.

  • #9
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Quote Originally Posted by westes View Post
    ok globals.php is this

    Code:
    <?php
    
    $mysql_connect('localhost', 'root', 'root') or die(mysql_error());
    // should be
    $con = mysql_connect(); // all that jazz in there
    $db = mysql_select_db("users", $con);
    
    ?>
    error is "Fatal error: Function name must be a string in /Applications/MAMP/htdocs/globals.php on line 3"
    Changes made.

  • Users who have thanked Brandoe85 for this post:

    westes (11-06-2008)

  • #10
    New Coder
    Join Date
    Aug 2008
    Posts
    64
    Thanks
    11
    Thanked 0 Times in 0 Posts
    HORAY FOR BRANDO85! IT WORKED!

    but i dont understand why it has an error from index.php not globals.php

  • #11
    New to the CF scene
    Join Date
    Nov 2008
    Location
    Missouri, USA
    Posts
    7
    Thanks
    0
    Thanked 1 Time in 1 Post
    It was because you were not running globals.php as a file, you were running index.php and it was including global.php


  •  

    Posting Permissions

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