Jump to content

ibinod

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ibinod's Achievements

Member

Member (2/5)

0

Reputation

  1. I've a table that has over a million of records, the table has a column `cat` varchar(250) NOT NULL with index i need to execute a query in this manner SELECT `cat`, COUNT(`cat`) as total FROM `products` GROUP BY `cat` HAVING `total` > 1 ORDER BY `total` DESC LIMIT 0, 200 and it takes about 2.5 sec to execute using index, temp tbl and filesort but when i remove the order by statement it only takes about 0.05 sec to execute with only using index. can someone please explain me what i can i do to minimize the execution time for my query with having orderby Thank you very much
  2. Hi, i am trying to make a simple code that can submit content automatically using curl i have the following code This is to login to the site which works perfectly $curl_connection = curl_init("http://www.familyfriendsphotos.com/login.php"); curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 300); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($curl_connection, CURLOPT_POST, 1); curl_setopt($curl_connection, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($curl_connection, CURLOPT_AUTOREFERER, true); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_connection, CURLOPT_TIMEOUT, 10); curl_setopt($curl_connection, CURLOPT_COOKIEJAR, ‘cookie.txt’); curl_setopt($curl_connection, CURLOPT_COOKIEFILE, ‘cookie.txt’); $post_data['uname'] = $dir['user']; $post_data['pswd'] = $dir['pass']; $post_data['Submit']="Login"; foreach ( $post_data as $key => $value) { //echo ("Key:".$key."=>".$value); $post_items[] = $key."=".$value; } $post_string = implode ("&", $post_items); //echo $post_string; curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); $result = curl_exec($curl_connection); unset($post_data); and to submit the article i have the following code curl_setopt($curl_connection, CURLOPT_URL, 'http://www.familyfriendsphotos.com/submitart.php'); $post_data['author'] = $article['author']; $post_data['parentId'] = $article['cat']; $post_data['f_arttitle'] = $article['title']; $post_data['f_artsummary'] = $article['short_desc']; $post_data['f_artbody'] = $article['article']; $post_data['f_artres'] = $article['resource']; $post_data['f_artkey'] = $article['keywords']; $post_data['key']="avachars_key"; $post_data['submit'] = "Submit"; foreach ( $post_data as $key => $value) { $post_items[] = $key."=".$value; } $post_string = implode ("&", $post_items); curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); $result = curl_exec($curl_connection); echo ($result); curl_close($curl_connection); But i get invalid http request like this Please tell me what should i do to fix this
  3. It'll be like this: echo preg_replace('/http:\/\/www.mysite.com\/name\/(.*?)\//ie',"strtolower('\\1')",$str); The e modifier tells it that the thing in the second argument should be evaluated as PHP code. Hi, thanks a lot it works when i use the e modifier but it add extra \ at the end how can i remove this
  4. if i use strtolower before preg_replace everything inside $str will be lowercased and i don't want that i just want the url last word to be lowercased and cud you please provde me a sampe code or something i tried various thing but it's not working
  5. Can anyone help me pls i can't get this working $str = '<p>The reality TV’s most hated man has some harsh words for Oscar-winning actress <a href="http://www.mysite.com/name/Angelina_Jolie">Angelina Jolie</a>'; echo preg_replace('/http:\/\/www.mysite.com\/name\/(.*?)\//i',strtolower('\\1'),$str); how can i modify this so the strtolower will work and only the last part string will be lowercased like Angelina_Jolie to angelina_jolie Thanx.
  6. thanx a lot neil i finally figured it out
  7. Hi, thanx again but $cats is an associative array so how do print it's contents on the first loop i want this to output like this <ul class="pics"> <li>this li for 12 times</li> </ul> <ul class="pics2"> <li>and this for the remaining time</li> </ul> i want to do this without breaking it
  8. Hi neil thanks for helping but it's not working as i want , i have done something like this but still i am having problem could you pls helpme i have come with this but still i am having some problem //$cats is an array containing database records <ul class="pics"> foreach($cats as $key => $cat) { if($key <12) { echo '<li>records with images'.$key.'</li>'; } else { echo '<li>records without images'.$key.'</li>'; } } </ul> this is it but i would like the second li with different ul class so how do i do it if i place ul after foreach it will loop <ul> and i don't want it i just want to change the class
  9. Hi, I am building a gallery and i am stuck with this please help me with this ok lets assume that i have 100 entries in my database cats table each with id, pic, thumb feild now in my php i want to do like this i want to select 70 entries and while looping i want to loop through the first 12 records and break it there and again from the same loop i want it to continue what i want is i want to show thumbs for the first 12 records and only text for the rest records, so how do i do this Thanks a lot
  10. //i have some text in the database like this $string = " �Public Enemy Number One� has long interested people who have then journeyed to visit his last resting place; ♪♫ Zac Efron & Jessica Alba WIN '07 Teen Choice Hottie Award"; // i have this function to remove un necessory tags (actually those are for urls) function sef_rep($name) { $name = html_entity_decode(strtolower($name)); $remove = array("/", "'", "`", "!", "(", ")", ".", "@", "+", " ", "_", "<", ">", "?", ":", ";", "&", "#", ","); $result_str = str_replace($remove, '-', $name); return $result_str; } //so when i echo this those special characters haven't gone echo sef_rep($string); so pls post me a solution to remove special chars like �
  11. Hello RussellReal, actually i m making a script to get news content from yahoo rss and along with it i am getting characters like those �♪♫ and making XHTML invalid, so what's the best way to remove those and similar chars and how do i loop through text to remove those, thanx
  12. hi, how can i remove special characters like �♪♫ i tried htmlentities, htmlspecialchars but i can't fix it, pls let me know how
  13. Thanx alot mate, that worked as i wanted. Regards
  14. Let's assume i have 100 different quotes to get from my database and i have seven different styles so i want to display those 0 to 100 quotes from (0- blue to 6- gray again 7-blue to 13-gray) like this Yes, somewhat like that, i tried that previously also but what happens there is it repeats each quote 7 time so i don't want it to repeat the quotes, just the colors from blue to gray
  15. acutally it's abit like this <?php $colors = array('blue', 'red', 'green', 'purple', 'orange', 'brown', 'gray'); ?> <?php foreach($author_quotes as $quote) : ?> <blockquote class=""><?php $quote['quote'] ?></blockquote> <?php // so what i want her is i want to use the colors in the above array in place of blockquote class ?> <?php endforeach; ?>
×
×
  • 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.