Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Hi I have dropdown menus wich contains name of players and opposition team. When user picks team for opposition to play against he clicks the submit button and isset function is triggered where the data from the dropdown menus will be captured and uploaded to the database.

It is simple enough but ive got what I guess is a syntax error. I get the message in the title when page is opened. Ive been trying to fix this with no luck. If someone can point me in the right direction it would be greatly appreciated.

 if ( isset($_POST['submit']) ) {
    $player_ids = array_map('intval', $_REQUEST['players']);
    $opponents_id = $_REQUEST['players'];

    var_dump($opponents_id);

    $query = 'SELECT `name`, `position` 
        FROM `player_info` 
        WHERE `player_id` IN (' . implode(',', $player_ids) . ')';

    $return_names = mysql_query($query) or die(mysql_error());

         while ( $row = mysql_fetch_assoc($return_names) ) 
        {
            $selected[] = $row['name'];
            $position[] = $row['position'];
        }

    $query = ("SELECT `fixture_id` 
            FROM `fixtures`
            WHERE `fixture_id` = $opponents_id"); 

            $result = mysql_query($query) or die(mysql_error());

            while ($row = mysql_fetch_array($query))
            {
                $fixture_id[] = $row['fixture_id']; 

            }
share|improve this question
    
The problem is in the second query –  Timothy Coetzee Oct 10 '13 at 5:50
2  
Is this a typo? $qury. In line $result = mysql_query($qury) or die(mysql_error()); –  JunM Oct 10 '13 at 5:51
    
try echoing $query, and put die(0); before $result statement. and try to run echoed $query result in phpMyadmin. You will get to know what went wrong. –  sanki Oct 10 '13 at 5:54
    
$qury is a typo well spotted –  Timothy Coetzee Oct 10 '13 at 5:55
add comment

2 Answers

I believe this is the problem: $qury

$result = mysql_query($qury) or die(mysql_error());

Change to:

$result = mysql_query($query) or die(mysql_error());

share|improve this answer
add comment
$query = ("SELECT `fixture_id` 
 ^ See Here
            FROM `fixtures`
            WHERE `fixture_id` = $opponents_id"); 

            $result = mysql_query($qury)                                    
                                   ^ See here

You have mistakenly types wrong variable in mysql_query.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.