[phorm] [Phorm:] Parse Error in complex MySQL log

  • From: webbbs@xxxxxxxxx
  • To: support@xxxxxxxxx
  • Date: 30 Mar 2004 03:41:24 -0000

The following new message has been posted on Phorm Support Forum at 
<http://www.phorm.com/support/>. 

*************************************************************************** 

  MESSAGE:  (#3921) Parse Error in complex MySQL log 
            <http://www.phorm.com/support/?rev=3921> 
  AUTHOR:   David Fisher 
  DATE:     March 29, 2004 at 10:41 p.m. EST 

I have a form that users can check one or more checkboxes for instruments 
indicating they want a quote for those products. I need to log this 
information to a MySQL database. Since many quote requests could have many 
products this results in a many-to-many database structure so I must insert 
each selected instrument to a table, with each quote id. The form passes an 
array to Phorm with each selected instrument in it. The best way I can figure 
is to loop through the array. To simplify things assume it looks likes this 
(which I have tried and is also broke): 
q_instrument[1] = "instrument 1" 
q_instrument[2] = "instrument 2" 
etc... 

This is the DB logging section of my config file which uses PHP to set up the 
$PHORM_MYVARS. I have reduced this to the simplest case: 

$PHORM_MYDBV = "setdbv.php"; 

$PHORM_MYTABLE[0] = "web_visitor"; 
$PHORM_MYVARS[0] = "first_name=q_first_name, last_name=q_last_name, 
email=PHORM_FROM"; 

$PHORM_MYTABLE[1] = "quote_req"; 
$PHORM_MYVARS[1] = "visitor_id=PHORM_MYSQLID[0], req_details=q_details, 
quote_origin=q_origin"; 

$q_instrument[3] = "Instrument 3"; 

//This line resets the array $q_instrument, so it always starts the loop at 
the beginning of the array. 

reset ($q_instrument); 

//This loops through the array each time assigning $key to the array index and 
$value to the value matched to each index. For testing $q_instrument contains 
only one entry 

while ( list ($key, $value) = each($q_instrument)) { 

$PHORM_MYTABLE[2] = "quote_instrument_type"; 

$PHORM_MYVARS[2] = "inst_type_id=$key, quote_req_id=PHORM_MYSQLID[1]"; 

$test_inst_type = "inst_type_id=$key, quote_req_id=PHORM_MYSQLID[1]"; 
} 

After submitting the form I get the correct ack page, with this message at the 
very top: 

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in 
/usr/local/httpd/superior-technical.com/phorm/phorm.php(1686) : eval()'d code 
on line 1 

but the rest of the ack page is correct. The first two database inserts work 
just fine. There is an insert that happens on $PHORM_MYTABLE[2], it has the 
correct quote_req_id, but the inst_type_id is always 0, when it should be set 
to $key or 3 in the test. If I print out the test variable: 
$test_inst_type = "inst_type_id=$key, quote_req_id=PHORM_MYSQLID[1]"; 

It will print 

inst_type_id=3, quote_req_id=PHORM_MYSQLID[1] 

Which is correct. My conclusion is that Phorm does not use MYSQL_VARS[2] as 
literal string, so my little substitution won't work. 

Is my logic wrong, or is this a bug in Phorm, or is my DB logging request 
outside of Phorm's frame? 

Phorm version 3.5.1 
PHP version 4.1.2 
MySQL version 3.23.39 
Apache version 1.3.20 
Redhat 8.0 Linux 

*************************************************************************** 

This is an automatically-generated notice.  If you'd like to be removed from 
the mailing list, please visit Phorm Support Forum at 
<http://www.phorm.com/support/>, or send your request to webbbs@xxxxxxxxxx  If 
you wish to respond to this message, please post your response directly to the 
board.  Thank you! 
-------------------------------------------------
You are receiving this message because you are subscribed to the Phorm mailing 
list. To send messages to the mailing list, simply send email to 
phorm@xxxxxxxxxxxxx from the address you have subscribed. You may unsubscribe 
from the list by sending email to phorm-request@xxxxxxxxxxxxx with 
'unsubscribe' in the SUBJECT field.

Other related posts:

  • » [phorm] [Phorm:] Parse Error in complex MySQL log