Jump to content

Name cannot begin with the '' character


jakebur01

Recommended Posts

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');
?>

Link to comment
https://forums.phpfreaks.com/topic/238889-name-cannot-begin-with-the-character/
Share on other sites

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]

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);
?>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.