Solved

PHP quote_smart not being written to database

Posted on 2007-11-25
2
1,005 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
ID: 20347569
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
ID: 31410901
Thanks.  I noticed that after I posted this question and I was just finishing up testing.

Alan
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

867 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