Jump to content

Ricky.

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ricky.'s Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Have been searching around and there are few but most of them comes with country and city only, no state / region in it, like http://www.geonames.org/export/ , its a comprehensive but no state wise division and its very big too.
  2. Do not run it at once, instead you run it in parts, like process 10K records at once then write in database what was the last record processed, on next run, script should check in DB from where to start and then again it will process 10K records. We do such things regularly in PHP on large data. I hope you get the idea
  3. I have not settled with any code yet, with simple xml I can directly access any node value like this : (say we have following string) $responseXML = '<?xml version="1.0"?> <methodResponse> <fault> <value> <struct> <member> <name>faultCode</name> <value><int>4</int></value> </member> <member> <name>faultString</name> <value><string>Too many parameters.</string></value> </member> </struct> </value> </fault> </methodResponse>'; $xml = new SimpleXMLElement($responseXML); echo '<pre>'; print_r($xml); echo '</pre>'; $fault = $xml->fault->value->struct->member[0]->name; $faultValue = $xml->fault->value->struct->member[0]->value->int; echo $fault , '<br />' , $faultValue; [/code] Now it will output faultCode 4 Certainly this way I can get value and using conditions , I can get to know what was response but issue is that node structure changes from service to service, sometimes there is no <fault> code at all, sometimes nesting structure is little different. Basically I need to find if response xml has "faultCode" or "Code" , then what is in next node which contains real faultcode, same goes with FaultString, I need to find if it has node with value faultstring and then what is value?
  4. Hi, I am wondering where you get Country / State / City list so that you can build Ajax based drop down menu during registration or asking for address.. I am sure there must be some list being maintained.. be it xml based or db based.. or we need to compile it manually .. one by one ?
  5. Hi I am kind of stuck at parsing xml-rpc response, it generally sends rsponse with following ways. 1. If PING is failed, you receive faultcode or sometimes only code with faultstring, like $errorStr1 I have given below in code block. 2. If ping is successful, you receive "flerror" , with message like I have mentiond as string in code block below as "$flResponse and $flResponse" <?php $errorStr1 = '<?xml version="1.0"?> <methodResponse> <fault> <value> <struct> <member> <name>faultCode</name> <value><int>4</int></value> </member> <member> <name>faultString</name> <value><string>Too many parameters.</string></value> </member> </struct> </value> </fault> </methodResponse>'; $flResponse = '<?xml version="1.0"?> <methodResponse> <params> <param> <value> <struct> <member> <name>flerror</name> <value><boolean>0</boolean></value> </member> <member> <name>message</name> <value>Thanks for the ping.</value> </member> </struct> </value> </param> </params> </methodResponse>'; $flresponse2 = '<?xml version="1.0"?> <methodResponse> <params> <param> <value> <struct> <member> <name>message</name> <value>Thanks&#32;for&#32;the&#32;ping.</value> </member> <member> <name>legal</name> <value>You&#32;agree&#32;that&#32;use&#32;of&#32;the&#32;Weblogs.com&#32;ping&#32;service&#32;is&#32;governed&#32;by&#32;the&#32;Terms&#32;of&#32;Use&#32;found&#32;at&#32;www.weblogs.com. </value> </member> <member> <name>flerror</name> <value><boolean>0</boolean> </value> </member> </struct> </value> </param> </params> </methodResponse>'; php?> Now problem is that no matter what I do, I can't make good use of it. What I need to do is if xml-RPC response contains following : <member> <name>flerror</name> <value><boolean>0</boolean></value> </member> <member> <name>message</name> <value>Thanks for the ping.</value> </member> I need to take out flerror with its value and message with its value. I am fiddling with SimpleXML, XMLreader, DOMdocument but can't find best way to do it. For example if we have : <member> <name>faultCode</name> <value><int>4</int></value> </member> <member> <name>faultString</name> <value><string>Too many parameters.</string></value> </member> in response then it means it was problem. If anyone with experience in this can help then would be great.. To make it clear, the response code varies from service to service, there always some tags missing or added so I can't directly access them simply using SimpleXML object, I need to find if certain tag exist then get its child values.
  6. Simply var_dump($_POST) and see whether you are actually receiving data for 'myname' or not. Also, before using $_POST['myname'] , you need to check if it really exists or not .
  7. Thats now another twist, is it hat ubercart is not being developed actively or there is no future for it ?
  8. I need advices based on your experience, I have little more than basic knowledge Drupal and now I am need to develop shopping website, I have opencart shortlisted but I am thinking instead of using open cart, should I go for Drupal Ubercart as I already know things about Drupal.. or it will better to go with full shopping cart ie. opencart and learn things right from beginning ?
  9. Hmm.. but I don't want to insert at all as they already there but Yes, it will update if its already there.. however I will need to know on what date.. But , I have already solved this issue, taking cues from your previous example, I splitted it two parts ie. one for dates on which employe is absent and one for employe is present. So, it makes two queries in total and also will first check if its already there then will not update. I actually made a function for this : <?php function update_individual_attendance($attendance , $uid) { // If all arrays are available If(is_array($attendance)) { $tmp = array(); // Separation of a and p foreach($attendance as $key => $value) { if($value == 'a') $tmp['a'][] = "'" . $key . "'"; if($value == 'p') $tmp['p'][] = "'" . $key . "'"; } // now updating all 'a' in db, it also saves us if person is not present at all if(is_array($tmp['a'])) { $sql_a = implode(',' , $tmp['a']); $result = mysql_query("UPDATE attendance SET status='a' WHERE date IN ($sql_a) AND status = 'p' AND st_id = $uid"); if($result) $reply = TRUE; else $reply = FALSE; } /// time for P to db if(is_array($tmp['p'])) { $sql_p = implode(',' , $tmp['p']); $result = mysql_query("UPDATE attendance SET status='p' WHERE date IN ($sql_p) AND status = 'a' AND st_id = $uid"); if($result) $reply = TRUE; else $reply = FALSE; } } else $reply = FALSE; return $reply; } ?> I have tried to make all comments for explaining process, if any suggestion then let me know. Also, as you suggested following case; <input type="radio" name="ap['a']" value="123" /> <input type="radio" name="ap['p']" value="123" /> <input type="radio" name="ap['a']" value="456" /> <input type="radio" name="ap['p']" value="456" /> <input type="radio" name="ap['a']" value="789" /> <input type="radio" name="ap['p']" value="789" /> In above scenerio , radio button will not work, thy will act independently ie. you can select both absent and present because their name are different. So point of radio button fails completely here.
  10. Can you see log files for mysql, it also happens if port: 3306 is used by some other service.
  11. Hey, thanx Little GUY and PFMaBiSmAd, but I think we are diverted because my actual issue is not receiving form data, I am already receiving it as array below(and above all this form is for single employe for various date where I am receiving employe ID as hidden field).... [2011-12-01] => a [2011-12-02] => a [2011-12-03] => p [2011-12-04] => p [2011-12-05] => p [2011-12-06] => a I only need to to update, for example, an employe could be ABSENT on 2011-12-01 But he was taken as PRESENT, now I need to fix, so I need to update 2011-12-01 to b to 2011-12-01 to a, However, issue arises only when I need to update many dates, like below [2011-12-01] => a [2011-12-02] => a [2011-12-03] => p [2011-12-04] => p [2011-12-05] => p [2011-12-06] => a So I have this data provided by form, now I need to check it against already submitted data and if STATUS is changed (see my original table design for STATUS column) then update in DB at once.
  12. Well, I will definitely need to check if it is already set to same status or not .. btw, wht do you mean that I I first find what are the rows changed and then insert data into them using separate query.. or just check each row , if data is changed then replace else do nothing using single query ? Please give example..that would be helpful.
  13. Hi, I am looking to update an already existing table, its an attendance table Its table design goes as follows: ------------------------------------------------- Date | employe ID | Status -------------------------------------------------- 12-03-2012| 232 | a 12-03-2012| 234 | a 12-03-2012| 235 | a 13-03-2012| 232 | p 13-03-2012| 234 | p 13-03-2012| 235 | a -------------------------------------------------- Here a = absent , p = present So, I have form which fetches existing table then returns result as below modified [2011-12-01] => a [2011-12-02] => a [2011-12-03] => p [2011-12-04] => p [2011-12-05] => p [2011-12-06] => a with userID as hidden value So, now I have update STATUS column, I can do it for one like : UPDATE records SET status = 'a' WHERE date = '2011-12-02' AND employe_id = userID So, it will update status to 'a' for this date 2011-12-02 where employe_id is userID Now issue is that I need to update most probably few hundred records at once and I am not able find any query which can do this in one SQL query, last resort could be using php loop but that will kill SQL server. I have tried to look into case and IN statement but I think I am not very good to do this currently.. any insight will be grateful .
  14. I had adopted this design and logically it was giving me headache on every step, I had to be real innovative to make things works other way, however, there were various situation like the employe who was always present in given time range.. I solved the issue but ultimately after deploying countless hours, I had to shift to the design I first proposed.. I did same task in 2 days for which it took me earlier 5 days (but yes with small db size).
  15. Hi, I have been doing small scale programming but I am now planning to foray into large scale, intensive web application to handle high traffic, definitely I need something fast, efficient and re-usable. Since I am programming for a while, I have my own collection of code which I use for base and generally am able to build fast and secure (small) web application. But now I am looking into framework. So, here is the question.. Should I look into framework like Yii , Kohana etc.. or Should continue building on my own code .. I just don't want to learn all those framework if and but then at the decides not to use them as I find them not really helpful !!!
×
×
  • 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.