Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Tried it but only displays the last word in the string
  2. Im having no luck with this: $search= "smarter than yogi"; foreach(str_word_count($search) as $word) $display= $word; echo $display; I get this error: Warning: Invalid argument supplied for foreach() in /mounted-storage/home/sub/sc-TQLI/XXXXXXXX.com/1.php on line 17
  3. How can i split a string into individual words: Original string: she walks down the street Split string: she<br> walks<br> down<br> the<br> street<br>
  4. Is there a function to measure time with decimals Im currently using this but it displays whole numbers "2", "1" not "0.67" etc $t1 = time( ); // page content $t2 = time( ); $ttime = ($t2 - $t1 );
  5. One way is to get the number of rows, then minus 100 then limit deletion submit_time ASC Thatll leave 100 newest rows
  6. None of these work... My string is "She walks down the street at night" and i used all the examples but the string stays the same $disallowed = array( "at", "the", "a", "or", "on", "On", "and" ); // and about 1 hundred other words lol. //set string $string = "She walks down the street at night"; //loop foreach($disallowed As $current_word){ $string = preg_replace("/\A[ ]{0,1}".$current_word."[ ]{0,1}$/i"," ",$string); } echo($string);
  7. Sometimes i have rows that are duplicates - but with different primary ids Table name: photo Column name: title I need to select only the rows that are duplicates I tried a distinct query but it just return all rows SELECT DISTINCT title FROM photo
  8. The ONLY way you can ever fail is by giving up. Websites are not traditional businesses. You start and put alot of effort in and get 50cents for your first month, you do a bit more and get 1.50 for your second month and it grows like that ....but your building on top of work youve already done so youll get to a point of duplication, where minimal effort is needed to earn 6 figures monthly. Its not "do now get paid now"...its "do now get paid later", as long as you dont give up Apart from that, if you dont have a reason to visit you site daily, other ppl wont either - simple!. Its good for your growth to have a few floppy sites, ive dumped 6 that have been squealers, and have 2 successful sites atm
  9. How can i strip common words from a string?? Original string: She walks down the street at night Strip common words "the" and "at" : She walks down street night Im thinking an array, but ive never done arrays before...
  10. Its ok, I have more that one an hour... No more indexing my directories, with my htaccess powers and url rewrites...for example i have urls like this: http://www.site.com/fake_directory/123/title/ Which in reality is; http://www.site.com/show?id=123&title=blablabla He cant be too intelligent cause hes trying to access : http://www.site.com/fake_directory This sites been hacked many times before but im not the moronic programmer i used to be
  11. That's from http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers Thanks for sharing. Did some more research on this: " " Ill keep an eye on my error log, he seems to have stopped, at its peak he was doing 200+ queries every hour.
  12. Create an index for all the columns your joining. you can do this in phpmyadmin under "Structure" then scroll down to "Indexes" the select "Create an index on x columns" and add all the columns your joining
  13. Does your column need to be text?? I would recommend changing it to VARCHAR if you can otherwise leave it as text. This will speed the query The second step is to create an index of the columns your joining You wont need an index for a single query but for joins you should use one, this should bring your query down to a millisecond
  14. If your only dealing with 3 numbers `new_weight` CHAR(2), That will truncate the last number
  15. What size are you columns your querying?? are they varcha,r blob, int etc
  16. Just use variables...like php would and you also need to SELECT first to check if it exists $sql = "SELECT * FROM table WHERE search='".$search_id."' "; if ( !( $result = mysql_query( $sql ) ) ) { } $search = mysql_num_rows( $result ); if ( 0 < $search ) { $sql2 = "UPDATE table SET search='".$search_id."' "; $result2 = mysql_query( $sql2 ) } else { $sql2 = "INSERT INTO table SET search_query='".$search_id."'"; $result2 = mysql_query( $sql2 ) }
  17. Over the past 2 days ive seen this in my error log: [Tue Feb 10 19:50:52 2009] [error] [client 207.32.18.73] File does not exist: /home/user/public_html/directory, referer: http://127.0.0.1:4664/preview?event_id=144624&schema_id=2&q=like&s=000000000000000000000000000 Is this a google thing or a hack attempt
  18. Impressive! Gonna get my own servers one day....think ill start with a P3
  19. Im too lazy to create the query for you but heres an example <?php // Make a MySQL Connection // Construct our join query $query = "SELECT table1.column, table2.column ". "FROM table1, table2 ". "WHERE table1.column = table2.column"; $result = mysql_query($query) or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ echo $row['column']. " - ". $row['column2']; echo "<br />"; } ?>
  20. Almost.. 2009-02-10 And update with $sql = "UPDATE date SET adddate='".date( "Y-m-d" )."'; mysql_query($sql) or die(mysql_error());
  21. Sometimes thumbnail images dont exist due to GD not making one , i need to check if the file exists otherwise display a default image Actual image <img src="http://www.site.com/thumb/7324.jpg" > and if image dosnt exist display this instead of nothing: <img src="http://www.site.com/no_image.jpg" >
  22. Are Persistent connections ok to use if you constantly query the database for small stuff like stats
×
×
  • 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.