Jump to content

mga_ka_php

Members
  • Posts

    134
  • Joined

Profile Information

  • Gender
    Not Telling

mga_ka_php's Achievements

Member

Member (2/5)

0

Reputation

  1. how do i write this in jquery? var state = document.getElementById("state"); state.options[state.options.length] = new Option();
  2. im trying to scrape the text of an image.
  3. is this possible to get the text in an image?
  4. thanks for all of your replies.
  5. i see that they use array in getting records from the database. while ( $row = @mysql_fetch_object( $this->result ) ) { $this->last_result[$num_rows] = $row; $num_rows++; } what if my records is 50,000. does array can hold that number of records, or does it use to much memory?
  6. why does wordpress is using foreach rather than while in listing records? common while ($products = mysql_fetch_object($rs) { ... } but wordpress is using foreach foreach ($posts as $post) { ... } which is better? because i'm trying to create my own code for database connection.
  7. so mysql_real_escape_string removes the quotes?
  8. i have a textarea and the content is description. how do i save this to database, because sometimes it has ' and " so it fails when i insert it into database, what should i use addslashes?
  9. what is the for writing { function myfunc { or function myfunc { it should be right after myfunc or below function myfunc?
  10. i have a form submission and it saves in my database. but sometimes i got weird characters, so when i display it on my site. the text content got weird error symbols. how do you handle those? thanks.
  11. how do you optimize this query? SELECT SUBSTR(eventDetails, INSTR(eventDetails, '|#|Name') + 8, INSTR(eventDetails, '|#|StartDate') - INSTR(eventDetails, '|#|Name') - eventTitle, SUBSTR(eventDetails, INSTR(eventDetails, '|#|City') + 8, INSTR(eventDetails, '|#|State') - INSTR(eventDetails, '|#|City') - city, IF(UNIX_TIMESTAMP(SUBSTR(eventDetails, INSTR(eventDetails, '|#|StartDate') + 13, 10)) = 0, SUBSTR(eventDetails, INSTR(eventDetails, '|#|StartDate') + 13, 10), UNIX_TIMESTAMP(SUBSTR(eventDetails, INSTR(eventDetails, '|#|StartDate') + 13, 10))) eventStartDate, IF(UNIX_TIMESTAMP(SUBSTR(eventDetails, INSTR(eventDetails, '|#|EndDate') + 11, 10)) = 0, SUBSTR(eventDetails, INSTR(eventDetails, '|#|EndDate') + 11, 10), UNIX_TIMESTAMP(SUBSTR(eventDetails, INSTR(eventDetails, '|#|EndDate') + 11, 10))) eventEndDate, SUBSTR(eventDetails, INSTR(eventDetails, '|#|State') + 9, INSTR(eventDetails, '|#|Zip') - INSTR(eventDetails, '|#|State') - 9) eventState FROM events WHERE eventDetails NOT LIKE '%Canceled:YES%' AND eventDetails NOT LIKE '%State:|#|%' AND eventDetails NOT LIKE '%Status:DELETED%' AND (eventDetails NOT LIKE '%PromoterPhone:|#|%' OR eventDetails NOT LIKE '%Link1:' OR eventDetails NOT LIKE '%UserNumber:0|#|%' OR eventDetails NOT LIKE '%UserNumber:|#|%') AND SUBSTR(eventDetails, INSTR(eventDetails, '|#|State') + 9, INSTR(eventDetails, '|#|Zip') - INSTR(eventDetails, '|#|State') - 9) = 'RI' HAVING ((eventStartDate BETWEEN '1261980000' AND '1282712400') AND (eventEndDate BETWEEN '1261980000' AND '1282712400')) ORDER BY eventStartDate ASC LIMIT 0, 20;
  12. as i said, one way. this is the thing that came up in my mind. but thanks for the another solution.
  13. <?php class cache { var $cache_dir = "cache/"; // Directory where the cache files will be stored var $cache_time = 7320; // How much time will keep the cache files in seconds var $caching = false; var $cache_file = ""; // Constructor of the class function cache() { $this->cache_file = $this->cache_dir . md5(urlencode($_SERVER["REQUEST_URI"])); if (file_exists($this->cache_file)) { //Grab the cache: $handle = fopen($this->cache_file, "r"); do { $data = fread($handle, 8192); if (strlen($data) == 0) { break; } echo $data; } while (true); fclose($handle); echo "<span style='font-size:8px;'>cache page loaded</span>"; exit(); } else { //create cache : $this->caching = true; ob_start(); } } // You should have this at the end of each page function close() { if ($this->caching) { // You were caching the contents so display them, and write the cache file $data = ob_get_clean(); echo $data; $fp = fopen(str_replace("/ww.", "/", $this->cache_file), 'w'); fwrite($fp, $data); fclose($fp); } } } ?> <html> <head> </head> <body> <?php include("cache.class.php"); ?> <?php $ch = new cache(); ?> THIS CONTENT WILL BE CACHED <?php $ch->close(); ?> </body> </html>
×
×
  • 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.