Solved

PHP quote_smart not being written to database

Posted on 2007-11-25
2
1,010 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

752 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