Jump to content

wfareed

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wfareed's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for your help , Got some issues with this one too but it is better than the older version , Thanks man
  2. i created this file to produce xml file to use is as rss feed , the file i created is here : <?php //output page as xml header("Content-type: text/xml"); //connect to mysql databse mysql_connect("localhost","root","") or die(mysql_error()); //select database to get data from mysql_select_db("blog") or die(mysql_error()); //start our query $sql = "SELECT * FROM articles ORDER BY id DESC"; //get the results $res = mysql_query($sql) or die(mysql_error()); //start XML $xml_output = "<?xml version='1.0' encoding='UTF-8'?>\n<section>\n"; for($x = 0 ; $x < mysql_num_rows($res) ; $x++){ $row = mysql_fetch_assoc($res); $xml_output .= "\t<rec>\n"; $xml_output .= "\t\t<idx>" . $row['id'] . "</idx>\n"; $xml_output .= "\t\t<article>" . $row['article_name'] . "</article>\n"; $xml_output .= "\t\t<author>" . $row['author'] . "</author>\n"; $xml_output .= "\t\t<contents>" . $row['article'] . "</contents>\n"; $xml_output .= "\t</rec>\n"; } $xml_output .= "</section>"; $foodata = $xml_output; $fp = fopen("rss.xml", "w"); fwrite($fp, $foodata); fclose($fp); ?> the php is producing this xml file with no errors : <?xml version='1.0' encoding='UTF-8'?> <section> <rec> <idx>3</idx> <article>testing</article> <author>wfareed</author> <contents>anything anything</contents> </rec> <rec> <idx>2</idx> <article>Then what ?</article> <author>damntraitors</author> <contents><p style="font-size:20px;"> Now the elections is over , And what happened had happened!. </p></contents> </rec> <rec> <idx>1</idx> <article>?????? ?</article> <author>damntraitors</author> <contents><p style="font-size:20px;">????? ?? ?????????? ???? ???? ? ???? ??? ???</p> </contents> </rec> </section> the issue is , when i try to read this xml file from any rss reader like google reader or rssreader or outlook rss reader i have an error saying that the file can not be processed as a valid RSS source !!!! any idea please ?
  3. Man ! U r brilliant , saved me a lot of time with a very simple code , I was pulling my hair out trying to figure it out , really appreciate your help a lot
  4. That is great and works prefectely , One more question , What if i need to include something like for bold text or for italic and so on , how can i combine all in one $search variable ?
  5. I am trying to create a script that will help me convert urls provided by users in their blog posts of PM to other users into a real clickable links , The script i created is working fine except that it is not converting after the 2nd link occurred in the post , I hope someone can help me with that. Here is the code : $text="Click [link]http://www.google.com.eg[/link] or click [link]http://www.yahoo.com[/link] or click [link]http://www.hotmail.com[/link]"; preg_match_all('/\\[link](.*?)\\[\/link]/s', $text, $links); $link_count=count($links); for($i=0;$i<$link_count;$i++){ $link_url=preg_replace("/\[link]/", "", $links[0][$i]); $link_url=preg_replace("/\[\/link]/","",$link_url); $text=str_replace($links[0][$i],"<a href=\"" . $link_url . "\">" . $link_url . "</a>",$text); } echo $text;
  6. Hello all My name is wael fareed , iam 34 years old , i am from Egypt I started coding with PHP in 2002 , i did not do it continuously because i did not have enough time to do so but now i am trying to recall what i already had learned before and i hope we can help each other . Good day to you all
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.