Jump to content

Marx

New Members
  • Posts

    5
  • Joined

  • Last visited

Marx's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes but i'm getting the tag from the url, so its being generated dinamically. For each of the season matches without having to enter them myself.
  2. Hey guys, I'm not very used to Mysql and this is the first INNER JOIN i need to do. I have 2 tables: 1st: Teams ID - 1 Team - Chicago Bulls Tag - chicago_bulls ID - 2 Team - Oklahoma City Thunder Tag - oklahoma_city_thunder ID - 3 Team - Philadelphia 76ers Tag - philadelphia_76ers ID - 4 Team - New York Knicks Tag - new_york_knicks 2nd: Matches ID - 1 Home - Chicago Bulls Away - Oklahoma City Thunder ID - 2 Home - Philadelphia 76ers Away - New York Knicks i'm trying to do a query that retrieves the names of the teams that will play against each other taken from the Matches table but this one just shows the name of the first of them: ID - Team - Tag 1 - Oklahoma City Thunder - oklahoma_city SELECT Matches.ID, Matches.Home, Matches.Away, Teams.Team FROM Teams INNER JOIN Matches ON Matches.Home = Matches.Tag WHERE Tag = 'oklahoma_city_thunder' LIMIT 0,1 Any idea? Thanks for the help.
  3. Good idea. Thanks cyberRobot & Ch0cu3r.
  4. They are not duplicated because it should have been: Example: $query = "INSERT INTO constructors (Constructor1, Constructor2) VALUES ('$constructors[0]', '$constructors[1]')"; and so on, that the part of the if/else statements. So i can get the pair and odd positions in the array. Obviously it doesn't make sense because it was just an example. I tried to do a concatenated query that starts in the if and ends in the else but i'm not sure if that possible because i keep getting mysql errors.
  5. <?php $constructors = array ('Renault', 'Citroen', 'Ferrari', 'Fiat', 'Seat', 'Honda', 'Toyota', 'Hyundai'); for ($u=0; $u< count ($constructors); $u++) { if ($u % 2 == 0) { echo 'Pair results:'. $constructors[$u].' '; echo '<br />'; } else { echo 'Odd results:'. $constructors[$u]; echo '<br />'; } }?> I have to insert the Pair result in one of the SQL Tables (Constructor1) and the Odd results in another of the tables (Constructor2) but as they are inside and if and else, i don't know how to do it. I tried with function but i noticed you can't use functions there. Any idea? Example: $query = "INSERT INTO constructors (Constructor1, Constructor2) VALUES ('$constructors[$u]', '$constructors[$u]')"; Thanks for your help.
  6. Marx

    Hey there

    Hi guys, I wouldn't call myself a PHP Freak but a PHP Fan, i have been using PHP for years but i have never mastered it. So be ready for a lot questions. I know JAVA, CSS and of course HTML. Cya around!
×
×
  • 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.