[Phplib-users] PHPLIB duplicate (one is blank) db inserts with Templates...
Brought to you by:
nhruby,
richardarcher
From: <an...@my...> - 2005-06-08 19:29:47
|
Dear list Been using PHPLib a few years back and started using it again for a project since the DB class, auth and sessions are just so easy and effective to use. Im running into a problem however. I have used FastTemplates on my pages and found that where I have a Insert statement that I try to do with : $squery = "INSERT INTO auto_messages(message_name,auto_messages) VALUES ('$Message_Name', '$Message')"; $aDb = new DB_oi_ct; $aDb->query("$squery"); ...as an example, this statement however always (on all pages where I would do some insert into the db) in one valid row of data entered and one blank line (Never just one entry) I thought that it might be fastTemplates and swithed over to phplib's own template but still got one valid db insert and one blank insert. I have also used a Mailing class to send mail and get the same thing, 2 emails arrive - one with values and one blank. I tried to print the query to see what the query look like and only one query (correct) displays. Ive enabled phplib debug echo and it also displays one query? My current environment is : Windows XP sp2 Installed phpdev423 - from firepages.com.au I have tried to play with the php.ini settings for track_vars, magic quotes etc (as per phplib doc) and restarted apache. I still get blank database inserts and blank emails. Also note if I take the template out of the picture and only use the DB object then everything works fine - then my insert query results in one entry only with valid values etc? Below is an example of code of one page : <? include_once("./php/prepend.php3"); page_open(array ("sess" => "oi_ct_Session", "auth" => "oi_ct_Challenge_Auth", "perm" => "oi_ct_Perm")); $perm->check("admin"); $auth->login_if($again); if ($auth->auth["uid"] == "nobody") { $relogin = '<A HREF="$sess->purl("$PHP_SELF?again=yes")">Relogin</A>to this page'; } else { $relogin = 'Logged in'; } $aDb = new DB_oi_ct; $aDb->query("$squery"); $squery = " INSERT INTO auto_messages ( message_name, auto_messages ) VALUES ( '$Message_Name', '$Message' )"; $tpl = new FastTemplate("./html/"); $tpl->define(array(main => "template.htm",)); $tpl->assign(array( HEADER => "TEST", BODY_HEADER => "NEW MESSAGE RECORD", TOP_MENU => "MENU", MENU_ITEMS => "", BOTTOM_MENU => "", BOTTOM_ITEMS => "" )); $text = "Updated ..."; $tpl->assign(BODY_TEXT, $text); $tpl->parse(MAIN, "main"); $tpl->FastPrint(MAIN); page_close(); ?> -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 2005/06/08 |