Jump to content

dflow

Members
  • Posts

    631
  • Joined

  • Last visited

Everything posted by dflow

  1. i have a script that uses uploadify to upload multiple imgaes worked fine suddenly stopped now even their demo isn't :confused: :confused: does this work for you? http://www.uploadify.com/demos/
  2. ok the post is working now a function i missed. now ay idea how to implement a loading gif here?
  3. i'm submitiing a form the following ajax refreshes the targeted div but the submit is not posting the form variables, jquery is included <script type="text/javascript" src="js/jquery.validate.js"></script> <script type="text/javascript" src="js/jquery.form.js"></script> <script type="text/javascript"> $('document').ready(function(){ $('#form').validate({ rules:{ "searchField":{ required:true, maxlength:40 }}, messages:{ "searchField":{ required:"This field is required" } }, submitHandler: function(form){ $(form).ajaxSubmit({ target: '#searchresults', success: function() { $('#formbox').slideUp('fast'); } }); } }) }); </script>
  4. sometimes the ADHD just gets you in a corner for anyone interested i solved this <?php //Insert Unique region id and update $query1 = 'SELECT country_id from worldcountrylist where enable =1 LIMIT 1 '; $results1 = mysql_query($query1); if (mysql_num_rows($results1) > 0) { while($row1 = mysql_fetch_array($results1)) { $query2 = 'select regionlist2233.region_name,regionlist2233.region_id,worldregionlist22.regionname ,worldregionlist22.regionid,regionlist2233.country_id from worldregionlist22 LEFT JOIN regionlist2233 on worldregionlist22.regionname = regionlist2233.region_name AND worldregionlist22.regionid <> regionlist2233.region_id AND worldregionlist22.country_id = regionlist2233.country_id where worldregionlist22.regionid REGEXP "^[0-9]+$" and regionlist2233.country_id <>100 ';} $results2 = mysql_query($query2); if (mysql_num_rows($results2) > 0) { while($row2 = mysql_fetch_array($results2)) { //echo $row2['city_id'].''.$row2['city_name'].'-'.$row2['region_id'].'-'; $row2['region_name'].' change with '. $row2['regionname'].'<br>'; $row2['region_id'].' change with '. $row2['regionid'].'<br>'; //echo $row2['worldregionlist22.regionid'].'<br>'; $query = 'UPDATE citylist2233 SET region_id ='.$row2['region_id'].' where region_id ='.$row2['regionid'].' and country_id='.$row2['country_id'].' '; echo $query.';<br><br>'; } }} ?>
  5. you'll need to try harder, that doesn't clear things up: you merged old and new inserting only new, now you need to update a different table with only old.... sorry kind of frustrated with this topic. and it's kind of holding me back it's like my plugin number and i'm live with a new service
  6. ???bump
  7. i'll try and make it clearer: i merged an old and new regionlist tables into one regionlist2233 skipping existing regions and inserting only new now i need to update the citylist2233 with the old region_ids db CREATE TABLE `citylist2233` ( `city_id` int(11) NOT NULL, `country_id` int(11) NOT NULL, `city_name` varchar(200) NOT NULL, `region_id` int(11) DEFAULT NULL, KEY `city_id` (`city_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `regionlist2233` ( `region_id` int(4) NOT NULL, `country_id` int(4) NOT NULL, `city_id` int(11) NOT NULL, `region_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `state_code` varchar(50) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `worldregionlist22` ( `country_id` int(11) NOT NULL, `countrycode` varchar(2) NOT NULL, `region_id` varchar(11) NOT NULL, `regionname` varchar(255) NOT NULL, `Enable` int(1) NOT NULL, `rid` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  8. please elaborate
  9. i have the following problem: im trying to update the region_id in citylist2233 according to the region_id in regionlist2233. i can compare regionlist2233.region_name = worldregionlist22.regionname and get the new and old id im messing the loop somewhere: <?php //Insert Unique region id and update $query1 = 'SELECT country_id from worldcountrylist where enable =1 LIMIT 1 '; $results1 = mysql_query($query1); if (mysql_num_rows($results1) > 0) { while($row1 = mysql_fetch_array($results1)) { $query2 = 'SELECT * from citylist2233 where country_id ="'.$row1['country_id'].'" '; $results2 = mysql_query($query2); if (mysql_num_rows($results2) > 0) { while($row2 = mysql_fetch_array($results2)) { //echo $row2['city_id'].''.$row2['city_name'].'-'.$row2['region_id'].'-'; echo $row2['city_name'].'-'.$row2['city_id'].'-'.$row2['region_id'].'<BR>'; $query3='select regionlist2233.region_name ,regionlist2233.region_id from worldregionlist22 LEFT JOIN regionlist2233 on worldregionlist22.regionname = regionlist2233.region_name AND worldregionlist22.region_id <> regionlist2233.region_id AND worldregionlist22.country_id = regionlist2233.country_id WHERE regionlist2233.region_id="'.$row2['region_id'].'" AND regionlist2233.country_id="'.$row1['country_id'].'" '; $results3 = mysql_query($query3); if (mysql_num_rows($results3) > 0) { while($row3 = mysql_fetch_array($results3)) { echo $updatequery='UPDATE citylist2233 SET region_id='.$row3['region_id'].' WHERE region_id='.$row2['region_id'].' AND country_id='.$row1['country_id'].'';}} $update = mysql_query($updatequery) } } } } ?>
  10. ok some progress revised code the response is country_id undefined <script type="text/javascript"> function ajaxfunction(str) { if (str=="") { document.getElementById("country_id").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var id = document.getElementById("cid").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getCountry_idfunc.php?country_id="+str,true); xmlhttp.send(); } var selected_from_list = false; var u =document.getElementById("cid").innerHTML.id; $(function(){ setAutoComplete("searchField", "results", "../ajax_autocomplete/autocomplete_test.php?country_id="+u+"&part="); }); </script>
  11. i have the following code the get country_id ajax is executing the div as a test correctly how would i insert the result as a var in this line: setAutoComplete("searchField", "results", "../ajax_autocomplete/autocomplete_test.php?country_id=[iNSERT VAR]&part="); //need to insert the country_id <script type="text/javascript"> var selected_from_list = false; $(function(){ setAutoComplete("searchField", "results", "../ajax_autocomplete/autocomplete_test.php?country_id=&part="); }); //this working code: <script type="text/javascript"> function ajaxfunction(str) { if (str=="") { document.getElementById("country_id").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("country_id").innerHTML=xmlhttp.responseText; } } var testVars = ''; testVars = 'c='+country_id; xmlhttp.open("GET","getCountry_idfunc.php?country_id="+str,true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(testVars); return false; xmlhttp.send(); } </script> </script> yes I need to dive into ajax thanks
  12. Which one? Random? First? First in what order? actually i don't know, the list is too long and places have different ways of being spelled.(i'll need to decide on that later) let's say Random at first for example the following name for a place in Andora country_id,countrycode,City,city_name,region_id,Lat,Lng,city_id 127,ad,bicisarri,BiƧisarri,06,42.483333587646484,1.466666698455811,10017 127,ad,bixessarri,Bixessarri,06,42.483333587646484,1.466666698455811,10018 127,ad,bixisarri,Bixisarri,06,42.483333587646484,1.466666698455811,10019
  13. i have a db with different names for the same place i want to choose only one name from the list according to the GPS coordinates how would one select a distinct city_name from a list with same GPS coordinates and (that is 2 operands) CREATE TABLE `worldcitylist` ( `country_id` int(11) NOT NULL, `countrycode` varchar(2) NOT NULL, `city_name` varchar(255) NOT NULL DEFAULT '', `region_id` varchar(100) NOT NULL, `Lat` float(17,15) NOT NULL, `Lng` float(17,15) NOT NULL, `city_id` int(11) NOT NULL AUTO_INCREMENT, UNIQUE KEY `id` (`city_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
  14. well i wasn't clear enough the Show parameter is only set for SupplierID=10 but i still want the results from the other suppliers
  15. is it possible to include a condition in a query for specific . for example : if the product is from SupplierID=10 return only if Show=1 i want to search the whole DB Select ID FROM products WHERE Price=100 AND Condition ( if products.SupplierID=10 Show=1) hope i explained myself enough
  16. dflow

    validation help

    thanks i treid to implement it but nada <script> function validateStr(arr) { for(index=0;index<arr.length;index++) { if(/^[a-z]+$/i.searchform(arr[index]) === false) { alert("choose from list") return false; } } } var str = document.searchform.searchField.value var arr = str.split(" , "); </script> im trying to get the chosen result of an auto-complete to be validated
  17. dflow

    validation help

    for reason this accepts all now
  18. dflow

    validation help

    it's a client side on execution alert, not a POST validation
  19. I need to validated the following Pattern Name , Name , Name that's Uppercase or Lowercase space comma space i have the following: <script> function searchfieldvalidate(value) { return /^[a-z][A-Z]\W\,]+$^[a-z][A-Z]\W\,]+$^[a-z][A-Z]\W\,]+$/.test(value); } </script>
  20. Also, you have to check every step of the way for any errors. $maincon = mysql_connect('local', "root", "root"); if ($maincon === false) { print "Unable to connect to server. I don't know what to do so ..."; die(); } if (mysql_select_db("root") === false) { print "Unable to select database. So ..."; die(); } $query = "INSERT ..."; $success = mysql_query($query); if ($success === false) { print "The query failed: " . $query . " with error: " . mysql_error(); die("so"); } $ref_id = mysql_insert_id($maincon); Note: The die() function is only suggested here as a debugging tool. The script should do something intelligent when an error condition prevents future action. Calling the die() function will cause the script to exit, leaving your user with a blank white screen. Not very user friendly. ok guys, thanks for the feedbacks. it seems that i wasn't QAing systematically as it was a long form. apparently i had 2 INT fields which if left blank triggered the mysql_error and caused the $query not be executed. that's a different issue, i set them as NULL in the db but the error was still recurring why is that? so i solved it by checking if the fields are: if(isset($_POST['field'])) Conclusion find someone to QA and I should
  21. no to the same one this is a page that works on a per switch case for example: i have a general mysql_connect same db(root) require_once(db1.php); then to make sure the mysql_insert_id() gets a connection i created $maincon like this switch($page) { case 'add': require_once('dbinsert.php'); //insert query and mysql_insert // dbinsert.php is : $maincon = mysql_connect('local', "root", "root"); mysql_select_db("root"); //then $success = mysql_query($query); $ref_id = mysql_insert_id($maincon);
  22. mysql_error($maincon); returns no error what do mean by this " correct connection link in the mysql_query statement."?
  23. [quote author=PFMaBiSmAd link=topic=353420.msg1669129#msg1669129 date=1328702687] Are you sure the INSERT query executed without any error? [/quote] [code} var_dump($query); returns the data no error var_dump(mysql_error()); returns string(0) "" var_dump($_POST); returns array(20) the weird thing is that it sometimes works and sometimes doesnt, no connection errors how could i force an id insert ?
  24. wierd
  25. yes ID int NULL AI
×
×
  • 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.