jakebur01 Posted June 9, 2011 Share Posted June 9, 2011 I know this is not an error that php generates. But, I am using a program called popmonger that handles failed messages and it will run a php script to handle the message. I have it pointed to my php script. And in the log file it is throwing this error: Name cannot begin with the '' character, hexadecimal value 0x20. Line 1, position 12. Code I am using for testing: <?php include_once('inc/data.inc'); $query = "insert into failed_messages values ('0','0', '0', '0', '0')" or die('Could not insert'); mysql_query($query, $db) or die('could not query'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/238889-name-cannot-begin-with-the-character/ Share on other sites More sharing options...
gristoi Posted June 9, 2011 Share Posted June 9, 2011 you do not need the die statement on the end of the query string: $query = "insert into failed_messages values ('0','0', '0', '0', '0')"; Quote Link to comment https://forums.phpfreaks.com/topic/238889-name-cannot-begin-with-the-character/#findComment-1227495 Share on other sites More sharing options...
jakebur01 Posted June 9, 2011 Author Share Posted June 9, 2011 I changed it, but I still get the same error in the log file. And the data does not insert. <?php include_once('inc/data.inc'); $query = "insert into failed_messages values ('0','0', '0', '0', '0')"; mysql_query($query, $db) or die('could not query'); ?> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/238889-name-cannot-begin-with-the-character/#findComment-1227497 Share on other sites More sharing options...
jakebur01 Posted June 9, 2011 Author Share Posted June 9, 2011 This is really what I am looking to do. Get the failed address, query the customer database to get the customers info based on the failed address, then store this line into the MySQL failed_messages table. Then, ever so often I can send this list to someone in the office who can correct these wrong addresses. <?php include_once('inc/data.inc'); $failedaddress= $popmonger->FailedAddress; if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT CUSTOMER_NUM, CUSTOMER_NAME, PHONE_1 FROM AR_CUST_MAST WHERE EMAIL_1 = '$failedaddress'"; //print $sql; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} setlocale(LC_MONETARY, 'en_US'); while (odbc_fetch_row($rs)) { $acct=odbc_result($rs,"CUSTOMER_NUM"); $name=odbc_result($rs,"CUSTOMER_NAME"); $phone=odbc_result($rs,"PHONE_1"); } $acct =mysql_real_escape_string($acct); $name =mysql_real_escape_string($name); $phone =mysql_real_escape_string($phone); $query = "insert into failed_messages values ('0','$acct', '$name', '$phone', '$failedaddress')"; mysql_query($query, $db); ?> Quote Link to comment https://forums.phpfreaks.com/topic/238889-name-cannot-begin-with-the-character/#findComment-1227514 Share on other sites More sharing options...
wildteen88 Posted June 9, 2011 Share Posted June 9, 2011 What type of database are you using. Your code starts of with using odbc functions, then at the end of the script your using mysql functions (which are for use with MySQL databases only). These functions are not compatible with each other. Quote Link to comment https://forums.phpfreaks.com/topic/238889-name-cannot-begin-with-the-character/#findComment-1227681 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.