• Content count

  • Joined

  • Last visited

  • Days Won


abdelelbouhy last won the day on January 27 2013

abdelelbouhy had the most liked content!

Community Reputation

2 Neutral

About abdelelbouhy

  • Rank
  1. Hi, in your code thereis an issue when you fetch the result $query2 = mysqli_fetch_array($query,MYSQLI_ASSOC); note the second arg MYSQLI_ASSOC the next step is to get the status field from the result like that $result = $query2['status']; then test it if($result == "Expired"); and here is a link explain it http://uk3.php.net/mysqli_fetch_array
  2. Hi guys, i have two tables products and deleted_products i want to select products_id from the two tables where the field suspend = 1 but there's no relationship between the tables in other words i want all the products_id from the tables where suspend = 1 but the products_id in table one doesn't match produtcs_id in table 2 the only relationship i can find is the suspend in both tables is 1 my query string is like that select p.products_id as PID, dp.products_id AS PDID FROM products p, deleted_products dp WHERE p.suspend = dp.suspend and p.suspend = 1 it return zero result but the two tables have products with suspend = 1 thanx
  3. thank you very much mate now i got it all
  4. Thank you i was trying to figure it out all day but when i call it the last time with 2 parameters var old should have the previous one the one with 1 parameter instead of the one with no parameter because the object property has the same name find it should be overwritten i know you said it queued up all but how is that if the property name is the same
  5. Thank you very much now start to clear it a bit one more thing how the arguments inside the clouser refer to the function that is passed as the argument to the outer function shouldn't arguments inside the inner refer to the arguments of the inner function
  6. Sorry mate i fixed the indent my question is how the code calls different functions even if the arguments length is always 0 or i'm missing something
  7. Hi guys, can you please explain how this code is working i'm a bit confuse about the fn.length == arguments.length here the code function addMethod(object, name, fn) { var old = object[name]; object[name] = function(){ if (fn.length == arguments.length){ //this line i don't understand how it works return fn.apply(this, arguments) }else if (typeof old == 'function'){ return old.apply(this, arguments); } }; } var ninjas = { values: ["Dean Edwards", "Sam Stephenson", "Alex Russell"] }; addMethod(ninjas, "find", function(){ return this.values; }); addMethod(ninjas, "find", function(name){ var ret = []; for (var i = 0; i < this.values.length; i++) if (this.values.indexOf(name) == 0) ret.push(this.values); return ret; }); addMethod(ninjas, "find", function(first, last){ var ret = []; for (var i = 0; i < this.values.length; i++) if (this.values == (first + " " + last)) ret.push(this.values); return ret; }); when you call addMethod the first time fn.length == arguments.length is true both are zero that's fine then it execute return fn.apply(this, arguments) the second and third fn.length is 1 then 2 but arguments.length is 0 because no args passed to the anonymous function and it should execute return old.apply(this, arguments); but what happened it execute the first condition so how comes it execute this line even if the lengths are not equal
  8. Hi guys is there any function can increase image size for example from 20 KB to 40 KB without changing the height and width Thanx
  9. many thanks is there is anyway in php let me download more than a file in one http request the problem is after i create the five files i need to download them all together that why i'm trying to zip them
  10. the full path is like that ADMIN . 'files/csv/amazoninventorysku/ the folder got created and zipped and the files is added to it but it's empty
  11. hi guys i'm having a problem zipping files to folder what is happing the script zip the folder and add some files to that folder then it download the folder but when i unzip the folder i find empty files with 0 KB but when i download via FTP( the unzipped files) contain content any idea the code is like that $zip = new ZipArchive; generate the filegenerateAmazonSkuCSV($arra_sku_uk,$csvsavefilepath,'cb_uk');$csvdowloadfilepath = 'files/csv/amazoninventorysku/';$file_type = 'application/csv';$file_name = "cb_uk_amazon_stock.csv";$file = DIR_FS_ADMIN.$csvdowloadfilepath . $file_name;if ($zip->open(DIR_FS_ADMIN.$csvdowloadfilepath .'changingbag_skus.zip', ZIPARCHIVE::CREATE) != TRUE) {die ("Could not open archive");}$zip->addFile($csvsavefilepath,$file_name);$zip->addFile($csvsavefilepath,$another_file);$zip->close();then download the file $file_found = downloadAmazonSkuFile( $file, $file_name, $file_type ); the function for downloadfunction downloadAmazonSkuFile( $file, $file_name, $file_type ){ if( ! is_file( $file ) ){return false; } $filesize = filesize( $file ); header('Content-Description: File Transfer');header('Content-Type: application/octet-stream');header('Content-Disposition: attachment; filename='.basename($file));header('Content-Transfer-Encoding: binary');header('Expires: 0');header('Cache-Control: must-revalidate, post-check=0, pre-check=0');header('Pragma: public');header('Content-Length: ' . filesize($file));ob_clean();flush();readfile($file); return true; }#func many thanks
  12. hello,if you replace onclick="cWindowHide();" with onClick="window.location.reload()" that's not going to work you removed the function that close the popup what you need to do is to assign document.location.reload() to onclick so your code should look like onClick="cWindowHide(); document.location.reload()" like that you call both functions
  13. try html5 autofocus attribute
  14. Hello,i'm trying to move uploaded file the problem is i want to move to another site but it's under the host so my host directory looks like that /var/www/vhosts site1 site2 site3 site4we are running the four sites from 1 back end which is site onewhen i use for site 1 $uploadFile = '/var/www/vhosts/site1/images/' . $_FILES[$image['table']]['name']; @move_uploaded_file($_FILES[$image['table']]['tmp_name'], $uploadFile);it works finenow i need to move it to site2 $uploadFile = '/var/www/vhosts/site2/images/' . $_FILES[$image['table']]['name']; @move_uploaded_file($_FILES[$image['table']]['tmp_name'], $uploadFile);now is not workingthe admin file which process the files uploaded is in site1 i also changed the writing permission exactly the same for all sitesplease helpthanks
  15. hello guys,this function just to get products_id function getProductId( $model, $importFrom = '' ) //retrun product id{ if( empty( $model ) ) { return 0; } if($importFrom == 'Play'){ $sql_where = " play_sku = '$model'"; }else{ $sql_where = " products_model = '$model'"; } $select_orderid_query_raw = "SELECT * FROM " . TABLE_PRODUCTS . " WHERE " . $sql_where; $select_orderid_query = tep_db_query($select_orderid_query_raw); $productsId = 0; while ( $orderId = tep_db_fetch_array($select_orderid_query) ) { $productsId = $orderId['products_id']; } return $productsId;}what happend is it return always 0 even that play_sku exists but when i hard code the $model to 5060164670018 which is the same if i pass it the function it return the right result$model i'm getting from file i read it with fgetcsv then i used the array to get the value of $model which is $arr[4] the $model field in sql is VARCHAR could it be because i'm looking for a number and the $model is passed as a stringplease help