Jump to content

Ken2k7

Members
  • Posts

    5,196
  • Joined

  • Last visited

    Never

Posts posted by Ken2k7

  1. Read file. That will return an array. That array has length equal to the number of lines in your text file. Each entry is a line in the file. So you can loop through it and just add the number at the end. :P

     

    Does that make sense? Give it a try. It's not as hard as I made it to be. The link to file has great examples already.

  2. It doesn't make a lot of sense to GROUP more than one column. You can order by more than one. Can you provide sample data where you need to GROUP multiple columns? So just give an example of the records in the database and give the final result on what the outcome should be.

  3. // add this function to the top
    // this function takes an array of strings
    function f ($array) {
         $new_array = array();
         foreach ($array as $key => $value) {
              $array[$key] = is_array($value)? f($value) : preg_replace('#[^\d]#', '', $value);
         }
         return $new_array;
    }
    
    // add these 3 lines after your echos
    $explode10 = f($explode10);
    $explode11 = f($explode11);
    
    echo $explode[0] + $explode11[0];
    

     

    You can change the function name.

  4. 13. Duplication of topics is strictly prohibited. Users will not post duplicate topics' date=' if a topic needs moved please use the "Report to Moderator" button and a staff member will move the topic as soon as possible.[/quote']

     

    http://www.phpfreaks.com/page/rules-and-terms-of-service

     

    Please use this - http://www.phpfreaks.com/forums/index.php/topic,296582.0.html

     

    As said, it should work. If not, then please show the output of those values.

  5. Would these queries make sense to what you're trying to do?

    $query = "DELETE a FROM attacktype_table a, encounter_table e WHERE a.encid = e.encid and e.starttime < DATE_SUB(CURDATE(),INTERVAL 30 DAY));";

     

    Or:

    $query = "DELETE a FROM attacktype a INNER JOIN encounter_table e WHERE a.encid = e.encid and e.starttime < DATE_SUB(CURDATE(),INTERVAL 30 DAY));";

  6. The PHP code is a bit confusing too because you have some code that doesn't really do anything except store some values into variables. I don't even know the final result of the SQL. So please post relevant bits of code or post what SQL you tried but it doesn't return the correct values.

  7. Okay, so you have 2 tables. Are they related in any way?

     

    Fruits         Vegiess         First row contain the records from category
    Bananas    Carrots         This and next row contain the records from items
    Apples        Potatoes
    

    That's confusing. Can you display the data as it appears in phpMyAdmin or something?

  8. i am talking about many to many relationship dude. i have to create a 3rd table to reference the 2 parent tables, you can say that it will be a foreign key  >:(

    Well, don't use terms that are made up like "bridge table" because obviously it doesn't mean anything to us. I'm sorry we are not psychic. We do try to help, but if we don't understand something, we ask. You probably should be more grateful to people who are spending their free time (without pay) to help you. Don't be mad at us for your bad terminology.

×
×
  • 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.