Results 1 to 3 of 3

Thread: [PHP CLI] Including files

  1. #1
    jw06's Avatar
    657
    posts
    Registered User

    [PHP CLI] MySQL Functions

    I'm making some scripts to do some basic mysql database updates and I was wondering if I can use include and require in them. I'm including in this case, a class file. Here is the code I have so far.

    PHP Code:
    #!/usr/bin/php4 -q 
    <?php
    $dbc 
    mysql_connect('localhost''****''****');
    $select mysql_select_db('omniboggle');
    require(
    '../class/harvestclass.php');
    if (
    $dbc){
        if (!
    $select){
            
    print_r(Error);
            
    #exit();
        
    }
    } else {
        
    print_r(Error);
        
    #exit();
    }

    $query "SELECT * FROM urls";
    if (
    $r mysql_query($query)) {
        while (
    $row mysql_fetch_array ($r)) {
            
    $url $row['url'];
            
    $gather = new Harvest_Keywords($url);
            
    $gather->process();
            
    print_r(Success$url);
        }
    } else {
        
    print_r(Error);
        exit();
    }

    mysql_close()
    ?>
    The Error:
    Parse Error: parse error in /home/omniboggle/www/spider/supdatespider.php on line 21.

    Line 21 is: $gather->process();

    Again, this script is being run from command line and not through a web page. I'm curious if this problem could have anythign to do with maybe I cant use mysql functions in the PHP CLI? Is there a way to check if its enabled or i need to add it or something of the sort.

    Thanks for the help!
    Last edited by jw06; February 26th, 2005 at 07:48 PM.

  2. #2
    jw06's Avatar
    657
    posts
    Registered User

    **UPDATE**

    It seems to be the mysql functions. I fixed the parse error. Now its giving me the error: Fatal Error: Call to undefined function: mysql_connect() in /home/omniboggle/www/spider/updatespider.php on line 2.

    How can I fix this? I have the php4-mysql module loaded.

  3. #3
    jw06's Avatar
    657
    posts
    Registered User
    bump?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012