Jump to content

vinpkl

Members
  • Posts

    448
  • Joined

  • Last visited

Everything posted by vinpkl

  1. hi ignace Like the search term is "Sony Ericsson T707". By using your implode code the search term become "SonyEricssonT707". I want the term to become "SonyEricsson T707". I want to implode only first two words, not all. vineet
  2. hi all i m showing search result according to query. $pnm=$row['product_name']; $pnm = explode(' ', $pnm); $qryc="select * from product_table where product_name LIKE '%$pnm[0]%' AND product_name LIKE '%$pnm[1]%' and category_id=4"; Now if somebody enters "Sony Ericsson T707" then it fetches "Sony Ericsson" as two separate words. I want that it should fetch "sony Ericsson" as one word like "SonyEricsson" removing their inbetween space. how can i do it. vineet
  3. HI GEVANS Thanks for the reply. i found the error mysql_query(qry_trk)) should be mysql_query($qry_trk)) vineet
  4. hi all i m updating my database table with the below code but its not updating. In database field name is "track_id" VARCHAR (60) $track_id=$_REQUEST['track_id']; if(isset($_REQUEST['submit'])) { $track_id=$_REQUEST['track_id']; $qry_trk="update new_order set track_id = '$track_id' where order_id = $id "; echo $qry_trk; if(mysql_query(qry_trk)) { $msg2="tracking id added & updated in database"; } else { $msg2="tracking id not updated"; } } on echo it displays corect information but it doesnt updates. update new_order set track_id = 'AS12345678' where order_id = 370 when i insert the above line in sql then it updates corectly but why is it not updating from php code. vineet
  5. hi joel24 thanks for the reply. works fine. vineet
  6. hi all i have multiple checkboxes which holds value of "order_id" in my form based on arrays. The code i m using works fine and deletes the order based on selected checkbox. When order gets deleted then it shows message "Order deleted". But the problem i m facing is that if the order doesnt gets deleted then also it shows message "Order deleted". Means everytime it shows same message "Order deleted successfully" whether order gets deleted or not. if(isset($_REQUEST['submit'])) { $selcheckbox=array(); $selcheckbox=$_REQUEST['item']; $count=count($selcheckbox); for($i=0;$i<$count-1;$i++) { $del_id = $selcheckbox[$i]; $qry2 = "delete FROM new_order WHERE order_id=$del_id and payment_status='PENDING'"; $result2 = mysql_query($qry2); if(mysql_query($qry2)) { $msg="order ( ".$del_id." ) Deleted Successfully"; } else { $msg="Error Deleting order"; } } } This is html echo "<td valign=top>". "<input type='checkbox' name='item[]' id='item[]' value=". $row['order_id']. ">"."</td>"; vineet
  7. hi mjdamato i want to add validation to my <select> options as <select name="choice" id="choice"> <option value="0">select choice</option> <option value="PENDING">Pending orders</option> <option value="PAID">Paid orders</option> </select> <input name="choice_submit" id="choice_submit" type="submit" value="click" onclick="return chose();" /> here is the complete validation <script language="javascript"> function chose() { if(document.form1.choice.value=='0') { alert("choose your option"); return false; } } function isChecked(checkGroup) { //Iterrate through each checkbox in the group //to ensure at least one is checked for (var i=0; i<checkGroup.length; i++) { if (checkGroup[i].checked) { return true; } } alert("Please select at least one."); return false; } function validateForm(formObj) { //Ensure at least one item is checked if(!isChecked(formObj['item[]'])) { return false; } //Confirm the deletion return confirm('Are you 100% totally certain that you want to DELETE this ?'); } </script> this is validation function chose() { if(document.form1.choice.value=='0') { alert("choose your option"); return false; } } But on click of the button it asks for selecting any checkbox instead of showing the result of selected <select> option. Even if i dont apply any validation to <select> box, then also on click of <select> submit button it asks for selecting checkbox. The checkbox validation code is conflicting with the <select> validation code as both are different. how can i rectify it. vineet
  8. hi mjdamato thanks for the code. it works great. i will do the changes also as suggested by you. vineet
  9. hi all i have one form inside other form in which i have delete button and i want to apply validation on it. This is form code <form id="form1" name="form1" method="get" action="" onsubmit='return cbox();'> <? echo "<form name='del_sel' method='post'>"; echo "<td valign='top' colspan='9'><input name='submit' type='submit' value='Delete Selected' onClick=\"return confirm('Are you 100% totally certain that you want to DELETE this ?')\"/>"; echo "<input type='hidden' name='checkbox[]' value=".$row2['order_id']." />"; echo "</td>"; echo "</form>"; ?> </form> this is validation function which checks whether one checkbox is selected or not. function cbox() { var chks = document.getElementsByName('checkbox[]'); var hasChecked = false; for (var i = 0; i < chks.length; i++) { if (chks[i].checked) { hasChecked = true; break; } } if (hasChecked == false) { alert("Please select at least one."); return false; } return true; } now the problem is that cbox() function and confirm function both appears one after another. i want that if cbox() returns true means if any one of the chekbox is selected then only the confirm alert should appear otherwise it should not appear. vineet
  10. hi Ken2k7 thanks for the reply. it works great as needed. but the checkbox doesnt remain selected. can checkbox remain selected until user uncheck it. or will it be done server side. vineet
  11. hi all i want to auto submit the form and run the update query on just selecting the checkbox. I m able to run the update query on selecting checkbox and clicking update button. But how can i auto submit form and run update query on just selecting of checkbox and without clicking the update button. i m using the below code but nothing happens <form action="http://localhost/gads/catalogue.php" method="post" name="product" id="product"> <input type="checkbox" name="rural" id="rural" onchange="product.submit();" </form> if(isset($_REQUEST['rural'])) { update query } vineet
  12. hi echofool i will surely post back the exact error i get while adding product. secondly Some $variables are within ' ' symbols because they are not integers or simply i can say they are not numeric values thats why are within these ' ' symbols. vineet
  13. hi daniel As i m using FCKeditor and image upload fields, so i wanted to upload image before fckeditor content. At present this code uploads the image after fckeditor and the image sometimes get missed somewhere and i have to upload it again. I dont know may be because of the heaviness of fckeditor content, the script times out or what happens but sometimes image misses out. My below code is according to sequence of fields in database. If i add the products according to this sequence then the product gets added successfully but sometimes image misses out and if i change the sequence of fields in this code then i get error. Like if i add 10 products then the 7 times the product get uploaded completely and 3 times the image misses out. $insertqry="insert into product_table(product_date, category_id, dealer_id, product_name, category_name, description, detail_description, cutout_price, price, image, shipping_cost, shipping_detail,warranty,sub_catg) values('$product_date',$catid,$dealerid,'$prod_name','$category_name','$prod_desc', '$prod_descbig', $prod_cutprice, $prod_price, '$path',$prod_ship,'$shipping_detail','$warranty','$sub_catg')"; Does this happen to everyone who changes the sequence of fields or is there any solution. Do you know any light version of fckeditor. vineet
  14. hi all i have a field name "detail_description" in my product_table on number 5. i have a field name "product_image" in my product_table on number 11. i want to interchange them and want to move "detail_description" field to number 11 and product_image field to number 5. As some data has been already been added to the database so i dont want to spoil my data. how can i do it safely vineet
  15. hi rhodes thanks for the code. now all problems solved. vineet
  16. hi rhodes thanks for the reply. i will check it server side for sub categories. the last thing i would like to ask that how can i make the selected option remain selected in the drop down. can it be done with javascript. vineet
  17. hi rhodes thanks. its works great as needed. now the problem is that some products dont have sub category. so they needed to be displayed on selecting first two drop downs of dealer_id and category_id. but the script that you have provided me doesnt works with only two drop downs. it applies window.location only if i select all three drop downs. so is there any solution that the product can be displayed on selecting two drop downs and also on selecting three drop downs or do i need to add some null value to third drop down. vineet
  18. hi rhodes yes i m getting JS error "dealer_id" is undefined But i dont get any error if i select dealer and category drop downs only. This error i get on selecting the third static drop down i created that is of sub category. Here is dynamic drop down for category <select name="category" onchange="getList(this.value)" id="category"> <option value="0">Select Main Category</option> <?php $qry1="select * from category_table"; $result1=mysql_query($qry1,$conn); if(mysql_num_rows($result1)>0) { while($row1=mysql_fetch_array($result1)) { echo "<option value=" .$row1['Category_id']; ?> }} ?> </select> This is dynamic drop down for dealer <select name="dealer" onchange="getProducts(this.value)" id="dealer"> <option>Select Dealer</option> <?php $category_id=$_REQUEST['category_id']; $qry="select * from dealer_table where category_id=$category_id"; $result=mysql_query($qry); while($row=mysql_fetch_array($result)) { echo "<option value = " . $row['dealer_id'];?> } ?> </select> vineet
  19. hi all i have two dynamic drop downs of dealer id and category id which work properly with window.location var dealerid; function getList(xyz) { window.location='manage_products.php?category_id=' + xyz; } function getProducts(dealer_id) { var catid=document.form1.category.value; window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid ; } but now i want to add static drop down of sub category and make use of window.location which i m not able to do <select name="sub_catg" onchange="getSb(this.value)" id="sub_catg"> <option>Select Sub Category</option> <option value="Batteries">Batteries</option> <option value="Leather & PU Cases">Leather & PU Cases</option> <option value="Crystal & Rubber Coated Cases">Crystal & Rubber Coated Cases</option> <option value="Car Mounts & USB Cradles">Car Mounts & USB Cradles</option> <option value="AC Chargers & Car Chargers">AC Chargers & Car Chargers</option> </select> This is function that is not working <script language="javascript"> var subid=document.form1.sub_catg.value; function getSb(subid) { window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid + "&sub_catg=" + subid ; } </script> vineet
  20. hi Dathremar no, the search form is not for only mobile phones. its for all the products in the database i.e. mobiles, cameras, memory cards etc vineet
  21. hi Dathremar If we work on a condition that user should only enter one product name at at time like "nokia n97" or "n97 nokia" then according to this it will show only n97 phone. i think this will solve my problem. but what will be the code to check and match the condition of numeric values. The below code will only show the result depending on the condition (SELECT fileds_to_select, red 1 FROM product_table WHERE ( (product_name LIKE '%n97%') OR ( product_name LIKE '%6100%') ) ) UNION (SELECT fileds_to_select, red 2 FROM product_table WHERE ( (product_name LIKE '%Nokia%') ) ) ORDER BY red but how will i match only the numeric values. like if "nokia n97" or "n97 nokia" is entered then i will match "97" numeric value in product name and show the result. if u can provide some code then i can play with queries and show result acordingly. vineet
  22. hi Dathremar Like i need to query for product model but that not possible in my case. But Is their any solution by which i can match the numeric figures in the product name like "97" or "72" or "85" and then display the result. Like in nokia n97 the query should match or find "97" in product name and if found it should display result of nokia n97 phone. and also tell whether the query will be able to match "97" with "n97" or only with "97". vineet
  23. hi Dathremar thanks for all the help. i will search for it. vineet
  24. hi Dathremar i understood ur answer that i should first query with manufacturer name and then by product model number. But my database has been designed in such a way that we are not entering manfucturer name and model number separately. they are entered in single string as product name. i cannot query separely with model number, so i m left with no choice. Product name is entered as "nokia n97". so i have to set query with product name but i m not able to find a solution in which if "nokia n97" is entered or "n97 nokia" is entered then in both case the product names which have "n97" in their name should display on top. vineet
  25. hi dathremar can u tell me where should i write sort query as i m getting the below error mysql_num_rows(): supplied argument is not a valid MySQL result here is the code with sort query i m using $search_parts = explode(" ", $model); $qry="select * from product_table ORDER BY product_name DESC where ("; $nb_parts = count($search_parts); for ($i = 0; $i < $nb_parts; $i++) { $qry .= " ( product_name LIKE '%". $search_parts[$i] ."%') "; if ($i == $nb_parts-1) $qry .= ")"; else $qry .= " OR "; } vineet
×
×
  • 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.