I am using the db2 database extention to create a prepared sql statement used for inserting data into an IBM iSeries. The problem I am having is one of the variable names on the iSeries side contains a # (pound sign/ hash). So the code should look like this, assuming # was a valid character in php. How do I get around this?

$sql = 'INSERT INTO RS63F.PN850HP1 (HTYPE, HFILE, MAILID, HBEG03,HVEND#) VALUES (?,?,?,?,?)';    
$conn = db2_connect($dB, $user, $pass);
$stmt = db2_prepare($conn, $sql);


db2_bind_param($stmt, 1, "HTYPE", DB2_PARAM_IN);
db2_bind_param($stmt, 2, "HFILE", DB2_PARAM_IN);
db2_bind_param($stmt, 3, "orderID", DB2_PARAM_IN);
db2_bind_param($stmt, 4, "orderName", DB2_PARAM_IN);
db2_bind_param($stmt, 5, "custID", DB2_PARAM_IN);

if (db2_execute($stmt)) {
    ECHO("SUCCESS");
};

The physical file has 59 variables and I only need to use 5 of them so I was hoping to use this method of insertion.

有帮助吗?

解决方案

I appologize,

This was actually a sublime text 2 issue. Sublime Text 2 made it look as if the # was commenting out the rest of the line. However that was not the case, I was able to leave the code the way it was and run it and it worked fine.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top