ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-lib
php-lib
[Phplib-users] PHPLIB duplicate (one is blank) db inserts with Templates...
by other posts by this author
Jun 8 2005 12:31PM messages near this date
Re: [Phplib-users] is phplib compatible with Apache 2.0? | Re: [Phplib-users] PHPLIB duplicate (one is blank) db inserts with Templates...
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
 



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Phplib-users mailing list
Phplib-users@[...].net
https://lists.sourceforge.net/lists/listinfo/phplib-users
Thread:

Andrew Crawford
Nathaniel Price

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved