Link to home
Start Free TrialLog in
Avatar of linuxrox
linuxroxFlag for United States of America

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 (\"&amp;what=zone:1\");   document.write (\"&amp;exclude=\" + document.phpAds_used);   if (document.referrer)      document.write (\"&amp;referer=\" + escape(document.referrer));   document.write (\"'><\" + \"/script>\");</script><noscript><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>

Avatar of alain34
alain34
Flag of United Kingdom of Great Britain and Northern Ireland image

could you post the complete script including the sql statement!
Avatar of linuxrox

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 ("&amp;what=zone:1");   document.write ("&amp;exclude=" + document.phpAds_used);   if (document.referrer)      document.write ("&amp;referer=" + escape(document.referrer));   document.write ("'><" + "/script>");</script><noscript><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-->','<!--start3-->');
            $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 (\"&amp;what=zone:1\");   document.write (\"&amp;exclude=\" + document.phpAds_used);   if (document.referrer)      document.write (\"&amp;referer=\" + escape(document.referrer));   document.write (\"'><\" + \"/script>\");</script><noscript><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 (\"&amp;what=zone:3\");   document.write (\"&amp;exclude=\" + document.phpAds_used);   if (document.referrer)      document.write (\"&amp;referer=\" + escape(document.referrer));   document.write (\"'><\" + \"/script>\");</script><noscript><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 (\"&amp;what=zone:2\");   document.write (\"&amp;exclude=\" + document.phpAds_used);   if (document.referrer)      document.write (\"&amp;referer=\" + escape(document.referrer));   document.write (\"'><\" + \"/script>\");</script><noscript><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($story, 0, $start);
            $storylasthalf=substr($story, $finish+$endlen);
            $story = $storyfirsthalf.$commentstart.$bannerfinal.$end.$storylasthalf;
            //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."-".$pday;
            
        $cat = $_POST['scats'];
        $title = addslashes($_POST['stitle']);
 
            $insert=mysql_db_query($dname,"INSERT INTO paths (id, relatedid, priority, relatedlink1, relatedlink2, relatedlink3, authorname, authoremail, organization, storydate, title, keyword, audioclip, webstory, datewritten, webstorynohtml) VALUES (NULL, '$relatedid','$priority','$link1','$link2','$link3','$author','$email','$organization','$fdate','$title','$skeyword','$sclip','$story','$today','$storynohtml')");
       
        foreach ($cat as $key => $value )
        $insert=mysql_db_query($dname,"INSERT INTO category (category, id) VALUES ('$value',LAST_INSERT_ID())");  
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
ASKER CERTIFIED SOLUTION
Avatar of alain34
alain34
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Lemme give you these points :)
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!