Jump to content

HarryMW

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by HarryMW

  1. Hi there, This is what I need to do, blow that is the code I have knocked up to do it but it doesn't seem to work. The main problem is the query that matches the atc callsigns to the pilots destinations.. can't fathom it myself. 1. Pull all the records from my database. 2. Assign their unique user id's, callsigns and destinations. 3. Execute a query in which you: SELECT * FROM CLIENTS WHERE (The 'clienttype' = 'ATC') AND match the callsign of the ATC users to the 'planned_destairport' of the 'clienttype' = 'PILOT'. For example if three people are going to Heathrow, then it would return 3 results. 4. Then do a mysql_num_rows of the result. 5. Lastly, execute a query that would update the 'atcarrivals' collumn in the database with the count number using the unique 'cid' as the identifier. All in a loop of course. // Selects all of the ATC Records. $atc_arrivals_selectquery = mysql_query ("SELECT * FROM CLIENTS"); // Starts the loop for fetching the records of the previous query. while($atc_arrivals_row = mysql_fetch_array($atc_arrivals_selectquery)){ // Sets the users cid, planned_destairport and callsign. $atc_cid = $atc_arrivals_row['cid']; $atc_destinations = $atc_arrivals_row['planned_destaiport']; $atc_callysign = $atc_arrivals_row['callsign']; // Searches the database and selects all records where the callsign is LIKE the destination airport. $atc_arrivals_check = mysql_query("SELECT * FROM CLIENTS WHERE clienttype = 'ATC' AND callsign LIKE '%$atc_destinations'"); // Counts previous query results. $atc_arrivals_count = mysql_num_rows($atc_arrivals_check); // Updates the atcarrivals column with the count.. $atc_arrivals_updatequery = mysql_query("UPDATE CLIENTS SET atcarrivals = '$atc_arrivals_count' WHERE cid = '$atc_cid' AND clienttype = 'ATC'"); // End loop. } Concerned columns are these: "cid" - Unique client id. "atcarrivals" - Number of arrivals from count. (This is the problem.) "planned_destairport" - Destination airport of pilot. Usually four letters long. IE. EGLL = Heathrow. Thanks.
  2. Hi there, Thank you for what you have pulled up and yes it works for that purpose, however all I need the code to do is go to the specific line starting "!CLIENTS", jump down a line- and pull the information from there on out until it reaches an empty line, where it will stop. This is so the query that will update and insert records if needed will only work for that block of information. Doesn't need to be outputted at that point. Harry.
  3. Theres an example, the datachunks are separated by the ":" character.
  4. Hi there, I need to know how to code a php file, to jump to a specific point in a text file. I haven't a clue what you would use and need the file to do very simply, or so it seems to find the line starting with: "!CLIENTS", then go to the next line and take the information from thereon out UNTIL it reaches a blank line, where it would dis-regard it and stop. Is that possible?
  5. Hello there, I am currently trying to code something for a lil' project I have been hood-winked in to and I could do with some help, probably silly things but it's driving me nutty. Firstly I need to connect to a text file which is online. So it won't be in a local directory but actually online and being updated whenever it is called. Secondly, I need to separate skip out the lines that start with the character ";", and also try to separate the different parts of the text file with headers that start with "!GENERAL", for example. There will be hundreds of entries so the results will need to be paginated obviously by 50 per page or something, if that's possible, hope so. Oh and the lines will have about 30 different pieces of information that will need to be inputted into a db and updated if the information is older that whats currently in the db. All of the sets of data are separated by this character ":". Any help will be appreciate, send me an e-mail on my address in my profile if you fancy giving me a quick hand at some point, thanks in advance. Harry.
×
×
  • 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.