clbryan26 Posted December 17, 2008 Share Posted December 17, 2008 I am trying to get a client account automatically created in SugarCRM when they are registered in WHMCS. I have modified the actionhooks.php file with the following code. Being that I am rather new to development and PHP can someone please point out where my problem is with the following code? Everything works it tells me that " Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mycommon/public_html/mybill/v1/includes/actionhooks.php on line 52" I have looked at my code and just can't figure it out. I also added a new field in phpmyadmin called mybillid to better reference the client account in WHMCS so that in the future I can perhaps do other functions and develop this temporary bridge further. #sugarcrm insert when created $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mycommon_v2", $con); mysql_query("INSERT INTO accounts ( id, name, date_entered, date_modified, modified_user_id, created_by, description, deleted, assigned_user_id, account_type, industry, annual_revenue, phone_fax, billing_address_street, billing_address_city, billing_address_state, billing_address_postalcode, billing_address_country, rating, phone_office, phone_alternate, website, ownership, employees, ticker_symbol, shipping_address_street, shipping_address_city, shipping_address_state, shipping_address_postalcode, shipping_address_country, parent_id, sic_code, campaign_id, mybillid) VALUES ('', '$vars["Email"]', NOW( ) , NOW( ) , NULL , NULL , NULL , '0', NULL , NULL , NULL , NULL , 'NULL', '$vars["Address1"]', '$vars["City"]', '$vars["State"]', '$vars["Postcode"]', '$vars["Country"]', NULL , '$vars["PhoneNumber"]', NULL, 'website', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '$vars["ClientID"]')"); Thanks for any help it is greatly appreciated and well noted! 0 Quote Link to comment Share on other sites More sharing options...
Matt Wade Posted December 17, 2008 Share Posted December 17, 2008 On each of the variables in your sql query that look like $vars["Address1"], change them as follows: $vars["Address1"] becomes {$vars['Address1']} Note that the quotes turned to single quotes and the entire variable is now inside curly braces. You need to do that for everything in the $vars array. 0 Quote Link to comment Share on other sites More sharing options...
clbryan26 Posted December 17, 2008 Author Share Posted December 17, 2008 Oh, that makes sense. Thank you so much! I was just copy/paste from the actionhooks.php file. 0 Quote Link to comment Share on other sites More sharing options...
clbryan26 Posted December 17, 2008 Author Share Posted December 17, 2008 Update: That fixed the errors but it didn't place anything into the database? 0 Quote Link to comment Share on other sites More sharing options...
Its Trish Posted December 19, 2008 Share Posted December 19, 2008 (edited) mycommon, You can debug it by placing your entire db insert line within an ECHO statement that outputs to screen, or, you can output to a temp file. then review the output (which will be your db insert command) and you'll quickly see what's incorrect about the db insert command. Most likely the variables' values are not appearing as you expected they'd be. trish : - ) Edited December 19, 2008 by Its Trish typo 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.