Jump to content

samshel

Members
  • Posts

    837
  • Joined

  • Last visited

About samshel

  • Birthday 09/13/1978

Contact Methods

  • MSN
    samirshelar@hotmail.com

Profile Information

  • Gender
    Not Telling

samshel's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks Kicken. My last option would be to disable APC. However it increases the performance tremendously and i want to keep that Thanks. i will keep looking. Thanks Sameer
  2. $str = 'Year78'; preg_match("/([0-9]+)/", $str, $matches); echo $matches[0];
  3. Thank you for the response. I am sure there are no errors or exit/die since when the page is refreshed it loads correctly without any changes. There is nothing in the error logs. It has something to do with APC caching since this problem was not there before i started using APC. It might be related to the TTL or update file lock, Not sure. Just wanted to check if someone else has had similar issue. I cannot try different things since this is a production environment and this issue is hard to reproduce on dev. Thanks Sameer
  4. Hi All, I am using PHP 5.4.14 along with APC on Linux for my production environment. Every once a while users browsing the website get a blank page on a POST action like searching for orders. Refreshing the page loads the page correctly. any idea? Following are setting for APC: cat apc.ini extension=apc.so apc.shm_size=150M apc.stat=0 Runtime settings: Runtime Settings apc.cache_by_default 1 apc.canonicalize 1 apc.coredump_unmap 0 apc.enable_cli 0 apc.enabled 1 apc.file_md5 0 apc.file_update_protection 2 apc.filters apc.gc_ttl 3600 apc.include_once_override 0 apc.lazy_classes 0 apc.lazy_functions 0 apc.max_file_size 1M apc.mmap_file_mask apc.num_files_hint 1000 apc.preload_path apc.report_autofilter 0 apc.rfc1867 0 apc.rfc1867_freq 0 apc.rfc1867_name APC_UPLOAD_PROGRESS apc.rfc1867_prefix upload_ apc.rfc1867_ttl 3600 apc.serializer default apc.shm_segments 1 apc.shm_size 150M apc.shm_strings_buffer 4M apc.slam_defense 1 apc.stat 0 apc.stat_ctime 0 apc.ttl 0 apc.use_request_time 1 apc.user_entries_hint 4096 apc.user_ttl 0 apc.write_lock 1 Any help is much appreciated. Thanks Sameer
  5. Check out stripslashes() http://php.net/manual/en/function.stripslashes.php
  6. @PFMaBiSmAd Yes. I understand. i am already working on validating the data before i put it in the query. I just want to know if this MySQL behavior is expected. As per your statement, MySQL will convert the variables inside quotes to float while comparing numeric values so that answers my question. Thanks
  7. Here it is. SELECT voos.order_id, po_number, voos.created_datetime, vendors.vendor_name, users.user_name, products.sku, oos.message FROM voos INNER JOIN vendors ON voos.vendor_id = vendors.vendor_id INNER JOIN products ON voos.order_item_id = products.order_item_id LEFT JOIN users ON voos.user_id = users.user_id LEFT JOIN oos ON voos.order_item_id = oos.order_item_id AND voos.vendor_id = oos.vendor_id WHERE voos.po_number = 'S5008044'; CREATE TABLE `voos` ( `id` int(11) NOT NULL auto_increment, `order_id` int(11) NOT NULL default '0', `order_item_id` int(11) NOT NULL default '0', `po_number` int(11) NOT NULL default '0', `vendor_id` int(11) NOT NULL default '0', `reason` varchar(255) default NULL, `created_datetime` datetime NOT NULL default '0000-00-00 00:00:00', `last_modified` datetime default NULL, `user_id` int(11) default NULL, PRIMARY KEY (`id`), KEY `order_id` (`order_id`), KEY `order_item_id` (`order_item_id`), KEY `vendor_id` (`vendor_id`), KEY `created_datetime` (`created_datetime`), KEY `last_modified` (`last_modified`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 the main issue is po_number is INT(11) and when i fire a query on the table with WHERE po_number = 'ALPHANUMERIC' it returns all rows with po_number = 0.
  8. Hi All, I am having a weird problem with a simple select with joins. Example Table Structure: id INT(11) - Primary Key another_id INT(11) - some_text VARCHAR (10) I am firing a SELECT query with WHERE clause SELECT * FROM table_name WHERE another_id = 'S123'; This returns all records from table where another_id = 0. another_id is INT and it converts the S123 to integer which is 0. Shouldn't MySQL return 0 records? this is just an example. Actual implementation has multiple joins. I know that i should be validating the input and convert it into integer. I will be doing that. However what baffles me is why MySQL behave in this way? Why does it treat a varchar input as 0 when comparing to an INT field? Is this normal? Thanks Sam
  9. use mysql_error(); $result=mysql_query($query) or die(mysql_error()); This is the first step that will tell you if your query is getting executed correctly.
  10. Try this. if (!isset($_SESSION['user_id']) && $_SESSION['user_id'] != '') { header ("Location: ../registration.php"); } Removed the () after the ! sign. It was checking for negation of both conditions. If you are logged in $_SESSION['user_id'] != '' will be true.
  11. try putting an exit after readfile. Is there any space at the end of the file after ?> PHP close tags? Manually try downloading the file and see if it opens?
  12. I think the closing of while loop as incorrect. You are doing all your for loops for row column inside your while loop for fetching records. No surprise you see only one record. Try this: <?php // Run a select query to get my letest 6 items // Connect to the MySQL database $min = 1; $max = 4; $sql = mysql_query("SELECT * FROM Products ORDER BY date_added DESC LIMIT $min,$max"); $number_of_products = mysql_num_rows($sql); // count the output amount if ($number_of_products > 0) { while($product = mysql_fetch_array($sql)){ $products_name[] = $product["product_name"]; $products_id[] = $product["product_id"]; $products_price[] = $product["credits"]; $products_added[] = strftime("%b %d, %Y", strtotime($product["date_added"])); } $number_of_rows = $number_of_products/5; $product_index = 0; $the_table = '<table>'; for($row=0; $row < $number_of_rows; $row++){ $the_table .='<tr>'; for($col = 0; $col < 5; $col++){ if($products_index < count($products_name)){ $the_table .= '<td><a href="product.php?id=' .$products_id[$products_index]. '"><img src="inventory_images/' .$products_id[$products_index]. '.jpg" alt="' .$products_name[$products_index]. '" width="77" height="102" border="1" /></a><br /><a href="product.php?id=' .$products_id[$products_index]. '">' .$products_name[$products_index]. '</a><br />' .$products_price[$products_index]. 'pts</td>'; $products_index++; }else{ $the_table .='<td><img src="../../images/noprofile.jpg" width="77" height="102" border="1"> <br />NO PRODUCT <br />NO PRICE</td>'; } } $the_table .='</tr>'; } $the_table .='</table>'; }else { $the_table = "We have no products listed in our store yet"; } mysql_close(); ?>
  13. There is no way you can instantiate a class without "including" the file. Either implicitly or explicitly you will have to include the class file. There would be frameworks which do that for you and support the format you desire, but the only difference is the framework will include the file instead of you doing in explicitly.
  14. $this->directory_list in your directory is not treated like an array but a string. try $this->directory_list = $dir[$i]; //store these
  15. try this not tested... echo '<textarea id="question"'. $questionNo .'" name="'.$qaArray["answerText"].'" cols="60" rows="2">'.(isset($questionNo) ?htmlentities($qaArray["answerText"], ENT_QUOTES) : '') .'</textarea>';
×
×
  • 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.