Solved

PHP quote_smart not being written to database

Posted on 2007-11-25
2
1,004 Views
Last Modified: 2013-12-12
I have a script to place some data into a table, and the script uses quote_smart.  Sometimes the data gets written to the table, however, I just came across a situation where it did not get written, and was wondering if anyone could offer some suggestions.

--------------------------------------------------------------------------------------

First, here is the code snippet:

    $query = sprintf('INSERT INTO team_email_pending (pm_sender, pm_sender_email, pm_sender_title, pm_subject, pm_message, '.$sql1.'pm_member_type, pm_recipients, pm_copy_coaches, pm_cid, pm_datetime, pm_unixtime, pm_ip, pm_host, pm_agent)'." VALUES(%s, %s, %s, %s, %s ".$sql2."%s, %s, '$copy_coaches', '$cid', '$timestamp', '$unixtime', '$ip', '$visitor_host', '$agent')",
            quote_smart($this_full_name),
            quote_smart($this_email_address),
            quote_smart($sender_title),
            quote_smart($email_subject),
            quote_smart($email_text),
            quote_smart($member_type),
            quote_smart($recipients));
      $result_query = @mysql_query($query);

--------------------------------------------------------------------------------------

The only difference between this and submissions that are successfully written are the subject and text.  In this particular case, the subject is:

Gift Cards! A note from Cindy McLain

and the text is:

New WAVE Families,

There will be 2 more gift card orders placed in 2007.  December 1st and December 15th are the next deadlines.  The latest gift card order form is located on the team web site.  Simply email me at fctm@bellsouth.net to place your order.

SPECIAL for the December 1st order ONLY!  Lowe’s Home Improvement is offering an additional discount, so that you can receive 5% off of these cards.  They are available in $25, $100, and $500 increments.  Normally the discount is less than 5% and the team is unable to grant the fund raising credit.  THIS IS A ONE TIME OFFER.

ALSO NEW TO THE ORDER FORM THIS MONTH IS MARRIOTT in $500 amount.  This is a great way for business travelers to earn fund raising for your account.

Remember STOCKING STUFFERS!!!!!!!!

Email me your orders by December 1st, and as always send me any questions.

Thanks,

Cindy McLain
fctm@bellsouth.net

--------------------------------------------------------------------------------------

Here is the result of the query:

INSERT INTO team_email_pending (pm_sender, pm_sender_email, pm_sender_title, pm_subject, pm_message, pm_member_type, pm_recipients, pm_copy_coaches, pm_cid, pm_datetime, pm_unixtime, pm_ip, pm_host, pm_agent) VALUES('Alan Pollenz', 'alan@webgrafxx.com', '', 'Gift Cards! A note from Cindy McLain', 'New Wave Families,
\r\n
\r\nThere will be 2 more gift card orders placed in 2007. December 1st and December 15th are the next deadlines. The latest gift card order form is located on the team website. Simply email me at fctm@bellsouth.net to place your order.
\r\n
\r\nSPECIAL for the December 1st order ONLY! Lowe\'s Home Improvement is offering an additional discount, so that you can receive 5% off of these cards. They are available in $25, $100, and $500 increments. Normally the discount is less than 5% and the team is unable to grant the fund raising credit. THIS IS A ONE TIME OFFER.
\r\n
\r\nALSO NEW TO THE ORDER FORM THIS MONTH IS MARRIOTT in $500 amount. This is a great way for business travelers to earn fund raising for your accpunt.
\r\n
\r\nRemember STOCKING STUFFERS!!!!!!!
\r\n
\r\nEmail me your orders by December 1st, and as always send me any questions.
\r\n
\r\nThanks,
\r\n
\r\nCindy McLain
\r\nfctm@bellsouth.net' 'Team', 'ALL', '', 'a8ba47bf9c3e28fe100ef0d2e006ed6b', '2007-11-25 18:35:24', '1196033724', '65.192.152.126', 'cpe-065-192-152-126.nc.res.rr.com', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9')

--------------------------------------------------------------------------------------

Any idea why this particular message is not being written?

Thanks.

Alan


$query = sprintf('INSERT INTO team_email_pending (pm_sender, pm_sender_email, pm_sender_title, pm_subject, pm_message, '.$sql1.'pm_member_type, pm_recipients, pm_copy_coaches, pm_cid, pm_datetime, pm_unixtime, pm_ip, pm_host, pm_agent)'." VALUES(%s, %s, %s, %s, %s ".$sql2."%s, %s, '$copy_coaches', '$cid', '$timestamp', '$unixtime', '$ip', '$visitor_host', '$agent')",

		quote_smart($this_full_name),

		quote_smart($this_email_address),

		quote_smart($sender_title),

		quote_smart($email_subject),

		quote_smart($email_text),

		quote_smart($member_type),

		quote_smart($recipients));

	$result_query = @mysql_query($query);

Open in new window

0
Comment
Question by:alanpollenz
2 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 total points
Comment Utility
You are missing a comma (,) after pm_message value
$query = sprintf('INSERT INTO team_email_pending (pm_sender, pm_sender_email, pm_sender_title, pm_subject, pm_message, '.$sql1.'pm_member_type, pm_recipients, pm_copy_coaches, pm_cid, pm_datetime, pm_unixtime, pm_ip, pm_host, pm_agent)'." VALUES(%s, %s, %s, %s, %s, ".$sql2."%s, %s, '$copy_coaches', '$cid', '$timestamp', '$unixtime', '$ip', '$visitor_host', '$agent')",

            quote_smart($this_full_name),

            quote_smart($this_email_address),

            quote_smart($sender_title),

            quote_smart($email_subject),

            quote_smart($email_text),

            quote_smart($member_type),

            quote_smart($recipients));

      $result_query = @mysql_query($query);

Open in new window

0
 

Author Closing Comment

by:alanpollenz
Comment Utility
Thanks.  I noticed that after I posted this question and I was just finishing up testing.

Alan
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now