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? Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/ 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 Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762709 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...() ??? Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762716 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. Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762720 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 ??? Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762746 Share on other sites More sharing options...
Mchl Posted February 15, 2009 Share Posted February 15, 2009 stripslashes Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762748 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? Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762751 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. Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762752 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>"; } ?> Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762765 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??? Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762785 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 Link to comment https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/#findComment-762794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.