Jump to content

beyzad

Members
  • Posts

    109
  • Joined

  • Last visited

Everything posted by beyzad

  1. Hi there. I have a query like the following: SELECT * FROM `products` LEFT JOIN `partner_products` USING ( `vendor_id` , `product_id` ) WHERE `partner_products`.`vendor_id` = '23060001' AND `partner_products`.`partner_id` = '1' As i read in many pages, the following query must export every rows in `products` table even if there is no matching row in `partner_products` table. but this only results rows with matching conditions. any suggestion please? Thanks.
  2. Hi. Im not sure, but i think this is because in your first rule, you redirected ALL urls. Try to expand you conditions.
  3. Hi. Ok i think it's still not too late to change my structure then. I'm not sure if i should post it here or not, so here we go: I have a table that contains many informations about incoming orders. The table name is factor. Each order may have any status from 1 to 7. But can only have one of them. Also each order has a unique key stored in 'factor_key' field. There is a long long (i mean time) process that will specify the order status. but no one will now which status will be the end of the order's journey. so i made 7 fields for storing 7 varriable time. Everytime my order's status changed, the time will stored in the respective field. There will be high amount of data in this table. Please tell me how should i change this. Regards.
  4. Hi. That was a nice story Sorry if i refused to use the way you guys said. My database structure is some kinda different with what you think. Regards.
  5. Hi again. Well i think i have to combine it with PHP. So i will export value of all the fields, the use max(). Thanks btw.
  6. Hi there. I have a problem again I have 7 fields named `factor_1_time`,`factor_2_time`,`factor_3_time`,`factor_4_time`,`factor_5_time`,`factor_6_time`,`factor_7_time` and each of them will hold a timestamp. I will never know which one of them have the maximum value. In other word, I dont know which onw of the following fields was updated last. Is there any query to get the field name that holds maximum value? Thanks
  7. Hello. I already did sir. my question is the difference between the two solutions above. Thanks
  8. Hi again. I was thinking about this: there are 2 methods for what i want: 1- Using ORDER BY RAND() 2- Using the method that 'PFMaBiSmAd' said. In both methods above, ALL fields from that table will be selected, then 20 of them will be exported randomly. The difference is in first method, MySQL Will select random rows and in second method, PHP will do that. Plus in the second method, we have 1 more condition in our query. Is the second method better than first by the way? Thanks
  9. Hi again. Yeah. my problem in exactly what you said 'PFMaBiSmAd'. Because of very very large DB, I was looking for the best solution and i think the way you said is cool. Thanks.
  10. Hi. Why you dont wanna rename your image? if you seriously dont want to rename your image, Then you can make a unique directory for each image.
  11. Hi there. I need a query to get 20 random data from my database using some conditions. So here is my code: <?php $max = single_field_q("SELECT MAX(`ads_product_id`) FROM `ads_products`"); $rand = rand(20 , $max); $products = multi_row_q("SELECT * FROM `ads_products` WHERE `ads_product_id`<" . $rand . " ORDER BY `ads_product_id` DESC LIMIT 20"); ?> It will work very well. But if i use my conditions, This will sometimes returns less than 20 results. And sometimes zero results I know why it returns less than 20. Now i need a solution for this. Thanks.
  12. did you check here? http://dev.mysql.com/doc/refman/5.1/en/server-logs.html Yes, but many pathes and files pointet to in that help are not same in Cpanel. Also looks like my WHM version has one .cnf file for each user!
  13. Hi there. I need my MySQL logs all queries with timestamp. I'm tired of searching in variable sites. each site said something different! So here are my server details. I hope you can help me: Control Panel: Cpanel/WHM 11.30.5 (Build 3) MySQL: 5.1.56-log OS: CENTOS 5.8 i686 standard Let me know if any other information are needed (Except root password ) Thanks
  14. Hi again. I don't know which part of code you need, Here is the code of the page that reported by users that lost their data. <?php session_start(); if(!$_SESSION['vendor']) { header('location: login.php'); } require_once('../inc/functions.php'); if($_POST['B1']) { run_q("DELETE FROM `factor_products` WHERE `factor_key`='" . addslashes($_GET['id']) . "'"); $sum_price = 0; $sum_weight = 0; for($i = 0 ; $i < 10 ; $i++) { if(!$_POST['id'][$i] || !$_POST['name'][$i] || !$_POST['price'][$i] || !$_POST['weight'][$i] || !$_POST['count'][$i]) continue; $id = addslashes($_POST['id'][$i]); $name = addslashes($_POST['name'][$i]); $price = intval($_POST['price'][$i]); $weight = intval($_POST['weight'][$i]); $count = intval($_POST['count'][$i]); run_q("INSERT INTO `factor_products` SET `factor_key`='" . addslashes($_GET['id']) . "' , `factor_product_id`='" . $id . "' , `factor_product_name`='" . $name . "' , `factor_product_weight`='" . $weight . "' , `factor_product_price`='" . $price . "' , `factor_product_count`='" . $count . "'"); $sum_price += ($_POST['price'][$i] * $_POST['count'][$i]); $sum_weight += ($_POST['weight'][$i] * $_POST['count'][$i]); } $stat_city_r = single_row_q("SELECT `factor_source_state`,`factor_source_city`,`factor_dest_state`,`factor_dest_city`,`factor_send_type` FROM `factors` WHERE `factor_key`='" . addslashes($_GET['id']) . "' LIMIT 1"); $send_price = send_price($stat_city_r['factor_source_state'] , $stat_city_r['factor_source_city'] , $stat_city_r['factor_dest_state'] , $stat_city_r['factor_dest_city'] , $sum_weight , $sum_price); if($stat_city_r['factor_send_type'] == 0) $send_price = $send_price['pishtaz']; if($stat_city_r['factor_send_type'] == 1) $send_price = $send_price['sefareshi']; run_q("UPDATE `factors` SET `factor_edited`='yes' , `factor_amount`='" . $sum_price . "' , `factor_weight`='" . $sum_weight . "' , `factor_send_price`='" . $send_price . "' , `factor_websky_amount`='" . ceil($sum_price * 4 / 100) . "' WHERE `factor_key`='" . addslashes($_GET['id']) . "' AND `factor_status`='0' AND `vendor_id`='" . $_SESSION['vendor'] . "' LIMIT 1"); header('location: order_pending.php'); } ?> Please notice that the lost row was in `factors` table. not the `factor_products` one. Thanks
  15. No, the row is completely gone. I also searched for any UPDATE or DELETE query that affects that table in all of my sources. Nothing found
  16. Hi. Did you tried var_dump() ?
  17. The field names are all correct and the variable names as well. If I put in the select statement in MySQL workbench, it also produces the correct results. Thank you for your time. Hi. Maybe you should add a space before AND? And hello? Where are you quotations?
  18. Hi there. I ask it simply. Is there ANY condition that an UPDATE query results a row deletion? Please notice that i only used UPDATE query in my codes, and i have 2 rows lost, that the linked page has no DELETE query at all! Thanks.
  19. Hi again. Finally got it. Those parameters will fetch into $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] I wonder why there is nothing in php.net or anywhere else about this... Regards
  20. Hi there. As i said, I am developing the web service. I used WSDL/SOAP in PHP. I have no problem using both server and client sides. But the only thing i can't understand is the following: <?php $params = array('login' => 'user_test' , 'password' => 'pass_test'); $client = new SoapClient('http://web.service/wsdl.xml' , $params); ?> At my server-side script, I am using the following: <?php class WebSkyClass { blahblahblahblah.... } $server = new SoapServer('wsdl.xml'); $server -> setClass('WebSkyClass'); $server -> handle(); But i still dont know how can i use $params that i used in soapclient() IN another language, I need to authenticate my webservice as all other webservices do. But i dont know how. Thanks
  21. Are you sure about this? <?php "SELECT quantity FROM grocery_cart WHERE username='cust_username' and product_id='bananaid' " ?> Do you mean this? <?php mysql_result(mysql_query("SELECT quantity FROM grocery_cart WHERE username='cust_username' and product_id='bananaid' "),0,0); ?>
×
×
  • 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.