plodos Posted February 15, 2009 Share Posted February 15, 2009 .sql <?php `name` text NOT NULL, ?> input is "aaaa & aaaa's & aaaaaaaaaa" input.php <?php if(isset($_POST['Submit'])) { $name = trim($_REQUEST['name']); } //insert into XXX set name='aaaa & aaaa's & aaaaaaaaaa' ?> rss.php <?php echo " <item> <title>".$opstr['name']."</title> </item>"; } ?> if name has & or ' characters, rss does not show anything? how will I solve this problem? Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 15, 2009 Share Posted February 15, 2009 Use CDATA wherever special character might appear. (Usually title and content tags) Oh... And while inserting data to mySQL use mysql_real_escape_string to escape special characters Quote Link to comment Share on other sites More sharing options...
plodos Posted February 15, 2009 Author Share Posted February 15, 2009 <?php if(isset($_POST['Submit'])) { $name = trim(htmlspecialchars($_REQUEST['name'])); } ?> I used htmlspecialchars() function...RSS is working now with these & " ' .. htmlspecialchars() is same with CDATA and mysql_real_escape...() ??? Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 15, 2009 Share Posted February 15, 2009 I can only say what I've tested and found to be working well. When I insert data onto database, I pass it through mysql_real_escape_string (no htmlspecialchars) When I create RSS feed, I use CDATA, where special characters might appear. Quote Link to comment Share on other sites More sharing options...
plodos Posted February 15, 2009 Author Share Posted February 15, 2009 you know what are you doing! i change it like that <?php $name = trim(mysql_real_escape_string($_REQUEST['name'])); <title> <![CDATA[ ".$opstr['name']." ]]> </title> ?> but if input is like that => & asda & asd " ' & ' " RSS is showing like that=> & asda & asd \" \' & \' \" how will I remove the \\\\\\\\\\\\\\\\\\ slashes ??? Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 15, 2009 Share Posted February 15, 2009 stripslashes Quote Link to comment Share on other sites More sharing options...
plodos Posted February 15, 2009 Author Share Posted February 15, 2009 hımmm I put the stripslashes()...thank you one more time. rss validator is giving me this error: line 14, column 0: item should contain a guid element (5 occurrences) line 39, column 0: Missing atom:link with rel="self" rss.php <?php $date = date("r", strtotime($opstr["rdate"])); echo " <item> <title>".$opstr['sname']." ".$opstr['year']." - <![CDATA[ ".stripslashes($opstr['name'])." ]]> </title> <description>".$opstr['city'].", ".$opstr['country']." - ".$opstr['cdate']."</description> <link>".$opstr['link']."</link> <pubDate>".$date."</pubDate> </item>"; } ?> What are the solutions of the these errors? Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 15, 2009 Share Posted February 15, 2009 They're explained on validator pages. for <guid> you can usually put same thing as for <link> missing atom:link with rel="self" is not erally an error, but recommendation. Quote Link to comment Share on other sites More sharing options...
plodos Posted February 15, 2009 Author Share Posted February 15, 2009 I coundt solve it.....what is wrong in <guid> section ? <?php echo " <item> <title><![CDATA[ ".stripslashes($opstr['name'])." ]]> </title> <description>".$opstr['city']."</description> <guid><http://www.w3.org/2005/Atom> Atom" rel=\"self\" href= ".$opstr['link']." type=\"application/rss+xml\" /> </guid> <pubDate>".$date."</pubDate> </item>"; } ?> Quote Link to comment Share on other sites More sharing options...
plodos Posted February 15, 2009 Author Share Posted February 15, 2009 I coundt solve it.....what is wrong in <guid> section ? <?php echo " <item> <title><![CDATA[ ".stripslashes($opstr['name'])." ]]> </title> <description>".$opstr['city']."</description> <guid><http://www.w3.org/2005/Atom> Atom" rel=\"self\" href= ".$opstr['link']." type=\"application/rss+xml\" /> </guid> <pubDate>".$date."</pubDate> </item>"; } ?> error: missing atom:link with rel="self" is not erally an error, but recommendation. My problem is that I have NO IDEA of how to "edit" my RSS feed with <guid>. Can anyone tell me how I locate my RSS feed and what I can use to edit the feed??? Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 15, 2009 Share Posted February 15, 2009 Now you're asking really strange questions... <guid> is just another tag, like <title>, <description> etc... See here for explanation http://cyber.law.harvard.edu/rss/rss.html#hrelementsOfLtitemgt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.