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
    Regular Coder
    Join Date
    Apr 2006
    Posts
    311
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Executing the query?

    How would I go about triggering the qurey in the following php, or will it simply execute -- on load???

    PHP Code:
    <?php

    define 
    ('DB_USER''root');
    define ('DB_PASSWORD''');
    define ('DB_HOST''localhost');
    define ('DB_NAME1''crm');
    define ('DB_NAME2''crm2');

    $dbc mysql_connect (DB_HOSTDB_USERDB_PASSWORD);

    $sql 'UPDATE crm2.contacts, crm.contacts'
            
    ' set crm2.contacts.deleted = crm.contacts.deleted,'
            
    ' crm2.contacts.date_modified = crm.contacts.date_modified,'
            
    ' crm2.contacts.modified_user_id = crm.contacts.modified_user_id,'
            
    ' crm2.contacts.assigned_user_id = crm.contacts.assigned_user_id,'
            
    ' crm2.contacts.agency_name = crm.contacts.agency_name,'
            
    ' crm2.contacts.full_name = crm.contacts.full_name,'
            
    ' crm2.contacts.first_name = crm.contacts.first_name,'
            
    ' crm2.contacts.last_name = crm.contacts.last_name,'
            
    ' crm2.contacts.do_not_call = crm.contacts.do_not_call,'
            
    ' crm2.contacts.phone_home = crm.contacts.phone_home,'
            
    ' crm2.contacts.phone_mobile = crm.contacts.phone_mobile,'
            
    ' crm2.contacts.phone_work = crm.contacts.phone_work,'
            
    ' crm2.contacts.phone_other = crm.contacts.phone_other,'
            
    ' crm2.contacts.phone_fax = crm.contacts.phone_fax,'
            
    ' crm2.contacts.email1 = crm.contacts.email1,'
            
    ' crm2.contacts.email2 = crm.contacts.email2,'
            
    ' crm2.contacts.assistant = crm.contacts.assistant,'
            
    ' crm2.contacts.assistant_phone = crm.contacts.assistant_phone,'
            
    ' crm2.contacts.email_opt_out = crm.contacts.email_opt_out,'
            
    ' crm2.contacts.primary_address_street = crm.contacts.primary_address_street,'
            
    ' crm2.contacts.primary_address_city = crm.contacts.primary_address_city,'
            
    ' crm2.contacts.primary_address_state = crm.contacts.primary_address_state,'
            
    ' crm2.contacts.primary_address_postalcode = crm.contacts.primary_address_postalcode,'
            
    ' crm2.contacts.primary_address_country = crm.contacts.primary_address_country,'
            
    ' crm2.contacts.alt_address_street = crm.contacts.alt_address_street,'
            
    ' crm2.contacts.alt_address_city = crm.contacts.alt_address_city,'
            
    ' crm2.contacts.alt_address_state = crm.contacts.alt_address_state,'
            
    ' crm2.contacts.alt_address_postalcode = crm.contacts.alt_address_postalcode,'
            
    ' crm2.contacts.description = crm.contacts.description,'
            
    ' crm2.contacts.cycle = crm.contacts.cycle,'
            
    ' crm2.contacts.last_cycle = crm.contacts.last_cycle,'
            
    ' crm2.contacts.mao = crm.contacts.mao,'
            
    ' crm2.contacts.gag = crm.contacts.gag,'
            
    ' crm2.contacts.invalid_email = crm.contacts.invalid_email'
            
    ' WHERE crm2.contacts.id = crm.contacts.id'
            
    ' AND crm2.contacts.date_modified < crm.contacts.date_modified'
            
    ' 'or die( "Unable to update database");        
     
    ?>

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    With mysql_query();
    http://us2.php.net/mysql_query

    Probly have to remove the or die from the sql and put it like, $result = mysql_query($query) or die(mysql_error());


  •  

    Posting Permissions

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