linuxrox
asked on
string won't store in mysql db
i'm busy working on another portion of a program; no time to diagnose this.
can someone tell me why this string isn't getting stored into my mysql table? (this is all on one line also)..no returns or anything.
<script language='JavaScript' type='text/javascript' src='http://www.xxxx.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2, 11); document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\"); document.write (\"http://www.xxxx.com/ads/adjs.php?n=\" + phpAds_random); document.write (\"&what=zone:1\"); document.write (\"&exclude=\" + document.phpAds_used); if (document.referrer) document.write (\"&referer=\" + escape(document.referrer)) ; document.write (\"'><\" + \"/script>\");</script><no script><a href='http://www.xxxx.com/ads/adclick.php?n=a0bcce5f' target='_blank'><img src='http://www.xxxx.com/ads/adview.php?what=zone:1&n=a0bcce5f' border='0' alt=''></a></noscript>
can someone tell me why this string isn't getting stored into my mysql table? (this is all on one line also)..no returns or anything.
<script language='JavaScript' type='text/javascript' src='http://www.xxxx.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,
could you post the complete script including the sql statement!
ASKER
this is the actual string that should get stored into the db:
<!-- web2printer:start -->hello there, this is an example of a story. A banner should follow right NOW:<!--start--><script language='JavaScript' type='text/javascript' src='http://www.k105.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2, 11); document.write ("<" + "script language='JavaScript' type='text/javascript' src='"); document.write ("http://www.k105.com/ads/adjs.php?n=" + phpAds_random); document.write ("&what=zone:1"); document.write ("&exclude=" + document.phpAds_used); if (document.referrer) document.write ("&referer=" + escape(document.referrer)) ; document.write ("'><" + "/script>");</script><nosc ript><a href='http://www.k105.com/ads/adclick.php?n=a0bcce5f' target='_blank'><img src='http://www.k105.com/ads/adview.php?what=zone:1&n=a0bcce5f' border='0' alt=''></a></noscript><!-- end-->And this is the last half of the story.<!-- web2printer:end -->
here is the portion of the script i'm working with:
(also, everything displays fine i know because if i exit the program before the string is to be placed into the database and echo it to the browser, it displays just fine....it is failing when entering the string into the database) perhaps it's the $storynohtml that is crapping it out.
$story = eregi_replace("[\r\n]",'', addslashes($data));
$story = "<!-- web2printer:start -->".$story."<!-- web2printer:end -->";
###############START BANNER CODE#################
$array = array('<!--start-->','<!-- start2-->' ,'<!--star t3-->');
$num = count($array);
for ($x=0; $x<=$num; $x++){
if (stristr($story, $array[$x])){
$commentstart = $array[$x];
}
}
$banner = "<script language='JavaScript' type='text/javascript' src='http://www.xxxx.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2, 11); document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\"); document.write (\"http://www.xxxx.com/ads/adjs.php?n=\" + phpAds_random); document.write (\"&what=zone:1\"); document.write (\"&exclude=\" + document.phpAds_used); if (document.referrer) document.write (\"&referer=\" + escape(document.referrer)) ; document.write (\"'><\" + \"/script>\");</script><no script><a href='http://www.xxxx.com/ads/adclick.php?n=a0bcce5f' target='_blank'><img src='http://www.xxxx.com/ads/adview.php?what=zone:1&n=a0bcce5f' border='0' alt=''></a></noscript>";
$banner2 = "<script language='JavaScript' type='text/javascript' src='http://www.k105.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2, 11); document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\"); document.write (\"http://www.k105.com/ads/adjs.php?n=\" + phpAds_random); document.write (\"&what=zone:3\"); document.write (\"&exclude=\" + document.phpAds_used); if (document.referrer) document.write (\"&referer=\" + escape(document.referrer)) ; document.write (\"'><\" + \"/script>\");</script><no script><a href='http://www.k105.com/ads/adclick.php?n=aed4b9df' target='_blank'><img src='http://www.k105.com/ads/adview.php?what=zone:3&n=aed4b9df' border='0' alt=''></a></noscript>";
$banner3 = "<script language='JavaScript' type='text/javascript' src='http://www.k105.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2, 11); document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\"); document.write (\"http://www.k105.com/ads/adjs.php?n=\" + phpAds_random); document.write (\"&what=zone:2\"); document.write (\"&exclude=\" + document.phpAds_used); if (document.referrer) document.write (\"&referer=\" + escape(document.referrer)) ; document.write (\"'><\" + \"/script>\");</script><no script><a href='http://www.k105.com/ads/adclick.php?n=aed4b9df' target='_blank'><img src='http://www.k105.com/ads/adview.php?what=zone:2&n=aed4b9df' border='0' alt=''></a></noscript>";
if ($commentstart=="<!--start -->"){
$bannerfinal = $banner;
}elseif($commentstart=="<! --start2-- >"){
$bannerfinal = $banner2;
}elseif($commentstart=="<! --start3-- >"){
$bannerfinal = $banner3;
}
$startlen = strlen($commentstart);
$end = "<!--end-->";
$endlen = strlen($end);
$start= strpos($story, "$commentstart");
$finish= strpos($story, "$end");
$length= $finish-$start;
$storyfirsthalf=substr($st ory, 0, $start);
$storylasthalf=substr($sto ry, $finish+$endlen);
$story = $storyfirsthalf.$commentst art.$banne rfinal.$en d.$storyla sthalf;
//echo $story;
//exit;
###############END BANNER CODE#################
$storynohtml = strip_tags($story);
$skeyword = $_POST['keywords'];
$sclip = $_POST['audioclip'];
$pday = $_POST['day'];
$author = $_POST['byname'];
$organization = $_POST['organization'];
$email = $_POST['email'];
$relatedid = $_POST['relatedid'];
$link1 = addslashes($_POST['link1'] );
$link2 = addslashes($_POST['link2'] );
$link3 = addslashes($_POST['link3'] );
$priority = $_POST['priority'];
$pmonth = $_POST['month'];
$pyear = $_POST['year'];
$today = date("Y-m-d");
$fdate = $pyear."-".$pmonth."-".$pd ay;
$cat = $_POST['scats'];
$title = addslashes($_POST['stitle' ]);
$insert=mysql_db_query($dn ame,"INSER T INTO paths (id, relatedid, priority, relatedlink1, relatedlink2, relatedlink3, authorname, authoremail, organization, storydate, title, keyword, audioclip, webstory, datewritten, webstorynohtml) VALUES (NULL, '$relatedid','$priority',' $link1','$ link2','$l ink3','$au thor','$em ail','$org anization' ,'$fdate', '$title',' $skeyword' ,'$sclip', '$story',' $today','$ storynohtm l')");
foreach ($cat as $key => $value )
$insert=mysql_db_query($dn ame,"INSER T INTO category (category, id) VALUES ('$value',LAST_INSERT_ID() )");
<!-- web2printer:start -->hello there, this is an example of a story. A banner should follow right NOW:<!--start--><script language='JavaScript' type='text/javascript' src='http://www.k105.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,
here is the portion of the script i'm working with:
(also, everything displays fine i know because if i exit the program before the string is to be placed into the database and echo it to the browser, it displays just fine....it is failing when entering the string into the database) perhaps it's the $storynohtml that is crapping it out.
$story = eregi_replace("[\r\n]",'',
$story = "<!-- web2printer:start -->".$story."<!-- web2printer:end -->";
###############START BANNER CODE#################
$array = array('<!--start-->','<!--
$num = count($array);
for ($x=0; $x<=$num; $x++){
if (stristr($story, $array[$x])){
$commentstart = $array[$x];
}
}
$banner = "<script language='JavaScript' type='text/javascript' src='http://www.xxxx.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,
$banner2 = "<script language='JavaScript' type='text/javascript' src='http://www.k105.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,
$banner3 = "<script language='JavaScript' type='text/javascript' src='http://www.k105.com/ads/adx.js'></script><script language='JavaScript' type='text/javascript'> if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,
if ($commentstart=="<!--start
$bannerfinal = $banner;
}elseif($commentstart=="<!
$bannerfinal = $banner2;
}elseif($commentstart=="<!
$bannerfinal = $banner3;
}
$startlen = strlen($commentstart);
$end = "<!--end-->";
$endlen = strlen($end);
$start= strpos($story, "$commentstart");
$finish= strpos($story, "$end");
$length= $finish-$start;
$storyfirsthalf=substr($st
$storylasthalf=substr($sto
$story = $storyfirsthalf.$commentst
//echo $story;
//exit;
###############END BANNER CODE#################
$storynohtml = strip_tags($story);
$skeyword = $_POST['keywords'];
$sclip = $_POST['audioclip'];
$pday = $_POST['day'];
$author = $_POST['byname'];
$organization = $_POST['organization'];
$email = $_POST['email'];
$relatedid = $_POST['relatedid'];
$link1 = addslashes($_POST['link1']
$link2 = addslashes($_POST['link2']
$link3 = addslashes($_POST['link3']
$priority = $_POST['priority'];
$pmonth = $_POST['month'];
$pyear = $_POST['year'];
$today = date("Y-m-d");
$fdate = $pyear."-".$pmonth."-".$pd
$cat = $_POST['scats'];
$title = addslashes($_POST['stitle'
$insert=mysql_db_query($dn
foreach ($cat as $key => $value )
$insert=mysql_db_query($dn
ASKER
I figured it out...merely addslashes($banner) solved it after i commented out //$storynohtml = strip_tags($story);
now i should just have to do the same to storynohtml
now i should just have to do the same to storynohtml
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Lemme give you these points :)
ASKER
wish i could edit out my domainname in this question but i guess i cannot.
post a question in community support to request the editing of the question and remove your domain name!