#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2008
    Posts
    5
    Rep Power
    0

    Fatal error: call to undefined function VIRTUAL()


    Hi all,

    Been reading through this forum for a couple of days now.
    I'm creating a website and trying to put data onto my webpage from database and viceversa (using dreamweaver). I'm not a programmer, hence why I was using dreamweaver.
    However, when I test my page i get the error:

    Fatal error: Call to undefined function virtual() in
    Code:
    /home/cle49413/public_html/user/user.php
    on line 1

    where line 1 of user.php is:
    Code:
    <?php virtual ('/Connections/registerdb.php'); ?>
    Now i've tried searching everywhere and reading this forum too but can't find the solution. Ive tried reading this too: (URL address blocked: See forum rules)

    but don't know how to fix it. total noob at programming.
    My understanding is it is better not to have .php file within that virtual command. could this be the problem?

    I had to download a dreamweaver extension to get a user to register, but now that i'm trying to display the users data in the 'user profile' page, i can't seem to do it because of this error.


    Thankyou
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Posts
    264
    Rep Power
    74
    When you call virtual as below

    PHP Code:
    <?php 
    virtual
    ('/Connections/registerdb.php'); 
    ?>
    you are calling a function. There needs to be a declared function somewhere, for example:

    PHP Code:
    <?php 
    function virtual($file)
    {
    return 
    $file;


    echo 
    virtual('/Connections/registerdb.php'); 
    ?>
    Where it echo's this will print '/Connections/registerdb.php' because your passing that value to the function 'virtual'. Virtual function accepts the passed value as $file. $file is then returned and echo displays what's been passed. NOTE that was just an example. Hope that makes sense.

    Have a read here:
    http://www.w3schools.com/PHP/php_functions.asp

    Good luck..
    ATOMIC Web Hosting 2006 - 2010
    Shared Hosting - Reseller Hosting - Dedicated Servers - Virtual Private Servers (Request Dedicated/VPS Servers via E-mail)
    E-mail: sales@atomicwebhosting.com Website: http://www.atomicwebhosting.com/

  4. #3
  5. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,276
    Rep Power
    4193
    Originally Posted by LifeSteala
    When you call virtual as below

    you are calling a function. There needs to be a declared function somewhere, for example:
    [phpnet=virtual]virtual()[/phpnet] is actually a PHP function, but you have to be using apache and have apache functions enabled.

    My guess is, what you want is the [phpnet=include]include()[/phpnet] function.

    Comments on this post

    • sarav_dude agrees : my guess too go with kicken :)
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2008
    Posts
    5
    Rep Power
    0
    thanks guys.. i'm still workin on it...
    include () does not work either, instead of a 1 line error, i get like 10 lines of errors. i've also tried the require() function.

    What I don't understand is, it was automatically generated by Dreamweaver, so i thought it should work without me having ot go in and change
    I'm at work atm, but when I get home i will try:
    Code:
    <?php  
    function virtual($file) 
    { 
    return $file; 
    }  
    
    echo virtual('/Connections/registerdb.php');  
    ?>
    or maybe it does have something to do with apache. I do not have anything as such installed on my computer, but do I need to? should by hosting company be running it though?
  8. #5
  9. Kage Bunshin
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2005
    Location
    The Seven Seas Of Rhye
    Posts
    927
    Rep Power
    427
    Originally Posted by Jag_sv
    ...or maybe it does have something to do with apache. I do not have anything as such installed on my computer, but do I need to? should my hosting company be running it though?
    I would not recommend installing Apache on a Windows based system. Its a whole can of worms you are currently not capable of handling.
    Last edited by tagmanadvance; May 20th, 2008 at 09:56 PM.
    "Java makes impossible things possible, but makes easy things difficult." - Somebody
  10. #6
  11. Permanently Banned
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2006
    Location
    In a whale
    Posts
    4,127
    Rep Power
    0
    it was automatically generated by Dreamweaver, so i thought it should work
    You contradict yourself!

    include () does not work either, instead of a 1 line error, i get like 10 lines of errors. i've also tried the require() function.
    What are the errors?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2008
    Posts
    5
    Rep Power
    0
    what I meant was teh virtual function was generated by Dreamweaver. Then i've tried replacing that with include() and require() etc...

    I'll have to see what the error messages were when I get home, i'm still at work.. counting down the hours!
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2008
    Posts
    5
    Rep Power
    0
    hi guys... god i've been busy this week, haven't had any time to work on the website. neways, i've tried the include() function and this is the error i get:

    Code:
    Warning: include(/Connections/registerdb.php) [function.include]: failed to open stream: No such file or directory in /home/cle49413/public_html/user/user.php on line 1
    
    Warning: include() [function.include]: Failed opening '/Connections/registerdb.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cle49413/public_html/user/user.php on line 1
    
    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/cle49413/public_html/user/user.php:1) in /home/cle49413/public_html/user/user.php on line 5
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/cle49413/public_html/user/user.php:1) in /home/cle49413/public_html/user/user.php on line 5
    
    Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/cle49413/public_html/user/user.php on line 64
    
    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'cle49413'@'localhost' (using password: NO) in /home/cle49413/public_html/user/user.php on line 36
    
    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/cle49413/public_html/user/user.php on line 36
    
    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/cle49413/public_html/user/user.php on line 66
    Access denied for user 'cle49413'@'localhost' (using password: NO)

    with apache, i'm gonna take your advice and not install it. But should my server/host be running it?
    I can see in my cPanel that they have a Apache Handlers. maybe i can use that?
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2008
    Location
    Wales
    Posts
    21
    Rep Power
    0
    In my opinion you would have few problems installing Apache if you were to take the shortcut of using something like XAMPP (just do a search) which gives you the complete PHP, MySQL and web server applications in one easy to install package. Some purists will no doubt moan about not installing the whole lot piecemeal but it's your simplest option. If you are using PHP anywhere on a website then I think you need to be able to test on your local machine (which XAMPP allows) as regards the DW generated function Virtual() I have had the same problem which I resolved by using the include() instead (and obviously tested locally - set up the testing server within the 'Site' menu in DW)- not quite sure why DW insists on the 'virtual' route.
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2008
    Posts
    5
    Rep Power
    0
    I have tried include now and the page loads! i just changed what was inside the brackets. i'm hpappy about that. Now the page doesn't exactly what I want it to do

    I was trying to display the user's details on the page. I've created the recordset etc but it doesn't display any data.
    I'm now wondering if that is because of the include function OR if it because i used the DW extension in the first instance to submit data to the database. Any ideas on this one?
    This query might actually belong in the webdesign section though...
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0
    I've had the same issues and solved the problem by changing two areas of line 1:

    (1) I changed 'virtual' to 'include_once' and
    (2) I deleted the first '/' from inside the brackets.

    The new line 1 now reads:
    <?php include_once('Connections/websitename.php'); ?>

    The old line 1 previously looked like this:
    <?php virtual('/Connections/websitename.php'); ?>

    I hope this helps

IMN logo majestic logo threadwatch logo seochat tools logo