I have this error upon loading page

Parse error: syntax error, unexpected T_VARIABLE in /home/a9752689/public_html/zadatak2/user.php on line 165

can you help me with it? I will post part code, if you need whole tell me

165 line is 28 here

<p align="center"><font color="#0000FF">Pregled grupa</font></p>



<p align="center">Grupa kojoj koncert pripada: 
  <form action = ‘<?= $_SERVER[‘PHP_SELF’]?>’ method = ‘post’>


   <select name="grupa_select" id="grupa_select">
      <?php
    while($row = mysql_fetch_array($sql))
    {
    echo "<option>".$row['grupanaziv']."</option>";
    }
    ?>
    </select>
 </p>

  <p align="center">
    <input type="submit" name="pregled_grupe" id="pregled_grupe" value="- Izaberi grupu-" />
  </p>
  <p>
    <label></label>
  </p>
  </form>
  <?php
   if (isset($_POST['pregled_grupe'])
  $con = mysql_connect($hostname,$db_username,$db_password);
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name, $con);
        $selektovanje = mysql_query("select id from grupe where grupanaziv ='".$grupa_select."'");
        $grupa_id = mysql_fetch_array($selektovanje);

  $pregled = mysql_query("select * from koncerti where $grupa_id['id'] = grupa_id");

  echo "'$pregled'";

?>

Thanks in advance

now new error

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a9752689/public_html/zadatak2/user.php on line 174

174 is 37

$pregled = mysql_query("select * from koncerti where $grupa_id['id'] = grupa_id");

I fixed that one, now I have error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9752689/public_html/zadatak2/user.php on line 35

which is

$grupa_id = mysql_fetch_array($selektovanje);

supplied argument is not a valid MySQL result resource

That means an error in your connection or query.

I have similar code in previous selection with same connection and everything and it works, i copied almost everything

 <?php
  if (isset($_POST['unos_koncert'])){
    $enter_koncert = $_POST['enter_koncert'];
    $enter_karte = $_POST['enter_karte'];
    $enter_mesto = $_POST['enter_mesto'];
    $enter_datum = $_POST['enter_datum'];
    $grupa_select = $_POST['grupa_select'];
    if (empty($enter_koncert)){
  die ("ERROR: Niste uneli naziv koncerta!");
  }
  $con = mysql_connect($hostname,$db_username,$db_password);
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name, $con);
        $sql = mysql_query("select id from grupe where grupanaziv ='".$grupa_select."'");
        $grupa = mysql_fetch_array($sql);
    $sql = "insert into koncerti values (NULL,'".$enter_koncert."','".$enter_karte."','".$enter_mesto."','".$enter_datum."',".$grupa['id'].")";
    if (!mysql_query($sql,$con))
    {
        die('Error: ' . mysql_error());
    }
    echo "Podaci uspesno uneseni u bazu podataka!";
  }
  ?>

$sql = mysql_query("select id from grupe where grupanaziv ='".$grupa_select."'");
$grupa = mysql_fetch_array($sql);

this is same code, just different variables

alright I fixed this one too now next its soo anoying,

error is

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9752689/public_html/zadatak2/user.php on line 35

which is

  $grupa_id = mysql_fetch_array($selektovanje);

Use mysql_error() to find the problem.

alright I did it and now 3 errors shows

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9752689/public_html/zadatak2/user.php on line 172

$grupa_id = mysql_fetch_array($selektovanje);

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/a9752689/public_html/zadatak2/user.php on line 176

if (!mysql_query($con,$selektovanje));

Free Web Hosting
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'grupa_id'' at line 1

here is whole code that gives bunch of errors

  <?php
   if (isset($_POST['pregled_grupe']))
  $con = mysql_connect($hostname,$db_username,$db_password);
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name, $con);
        $selektovanje = mysql_query("select id from grupe where grupanaziv =".$grupa_select."");
        $grupa_id = mysql_fetch_array($selektovanje);

  $pregled = mysql_query("select * from koncerti where grupa_id = ".$grupa_id['id']."");

  if (!mysql_query($con,$selektovanje));
    {
    die('Error: ' . mysql_error());
    }

  echo $pregled;

?>

PS I removed errors, but nothing is displayed from base uppon clicking submit
if (isset($_POST['pregled_grupe']))

I changed code a bit to show rows and after pressing submit button I get this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9752689/public_html/zadatak2/user.php on line 178

which is

while($row = mysql_fetch_array($pregled))

here is code whole code

 <?php
  $con = mysql_connect($hostname,$db_username,$db_password);
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name, $con);
        $selektovanje = mysql_query("select id from grupe where grupanaziv ='".$grupa_select."'");
        $grupa_id = mysql_fetch_array($selektovanje);

  $pregled = mysql_query("select * from koncerti where grupa_id = ".$grupa_id['id']."");


   if (isset($_POST['pregled_grupe'])) {
        echo "Koncerti za izabranu grupu su: ";
    while($row = mysql_fetch_array($pregled))
  {

    echo "<br>".$row['koncertnaziv'];
    echo "<br>".$row['mesto'];
    echo "<br>".$row['datum'];
    echo "<br>".$row['karte'];
  }
  }



?>

$selektovanje = mysql_query("select id from grupe where grupanaziv ='".$grupa_select."'");

$grupa_select may not have a value. If so then $grupa_id doesn't have one either.

it has value, because its option to choose band, and I have few bands as option already, and they have data in base, grupanaziv calls all options from base

<p align="center">Grupa kojoj koncert pripada: 
  <form action = "<? $_SERVER[‘PHP_SELF’]?>" method = "post">


   <select name="grupa_select" id="grupa_select">
      <?php
    while($row = mysql_fetch_array($sql))
    {
    echo "<option>".$row['grupanaziv']."</option>";
    }
    ?>
    </select>
 </p>

Do you have this somewhere then?

$grupa_select = $_POST['grupa_select'];

no, grupa_select is just for that form, it gets $sql which is previous defined

$sql = mysql_query("select * from grupe");

and it displays grupanaziv as options which is in table grupe, so after I can store ID from that grupa(band) and use it to select data from other table called koncerti (concerts)

It means your query contains white space. To avoid this problem you need to add mysql_real_escape_string($val)
ie,
mysql_query("select id from grupe where grupanaziv ='".mysql_real_escape_string($grupa_select)."'");

I am not geting error there, error stays same with and without that code u gave me

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9752689/public_html/zadatak2/user.php on line 178

which is

    while($row = mysql_fetch_array($pregled))

is this ok?

 if (isset($_POST['pregled_grupe'])) {
        echo "Koncerti za izabranu grupu su: ";
    while($row = mysql_fetch_array($pregled))
  {

    echo "<br>".$row['koncertnaziv'];
    echo "<br>".$row['mesto'];
    echo "<br>".$row['datum'];
    echo "<br>".$row['karte'];
  }
  }

what happens if I have more than one record for each koncertnaziv, mesto,datum,karte for selected band(grupanaziv)?

I am still in need of solution

I will appreciate help

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9752689/public_html/zadatak2/user.php on line 178

If you still have that error, use mysql_error() to find out what the problem is.

I did, here is whole code

 <?php
   if (isset($_POST['pregled_grupe']))  {
  $con = mysql_connect($hostname,$db_username,$db_password);
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name, $con);
        $selektovanje = mysql_query("select id from grupe where grupanaziv = '".($grupa_select)."'");
        $grupa_id = mysql_fetch_array($selektovanje);

  $pregled = mysql_query("select * from koncerti where grupa_id = ".$grupa_id['id']."");



        echo "Koncerti za izabranu grupu su: ";
    while($row = mysql_fetch_array($pregled))
  {

    echo "<br>".$row['koncertnaziv'];
    echo "<br>".$row['mesto'];
    echo "<br>".$row['datum'];
    echo "<br>".$row['karte'];
  }
  }


?>

$selektovanje = mysql_query("select id from grupe where grupanaziv = '".($grupa_select)."'");

$selektovanje = mysql_query("select id from grupe where grupanaziv = '".($grupa_select)."'") or die(mysql_error());
print_r($selektovanje);

Reply with the output.

Am pretty sure $grupa_select doesn't have a value.

here is code for grupa_select

<p align="center">Grupa kojoj koncert pripada: 
  <form action = "<? $_SERVER[‘PHP_SELF’]?>" method = "post">


   <select name="grupa_select" id="grupa_select">
      <?php
    while($row = mysql_fetch_array($sql))
    {
    echo "<option>".$row['grupanaziv']."</option>";
    }
    ?>
    </select>
 </p>

  <p align="center">
    <input type="submit" name="pregled_grupe" id="pregled_grupe" value="- Izaberi grupu-" />
  </p>
  <p>
    <label></label>
  </p>
  </form>

wait I have it in several forms not just in one, maybe thats problem, let me try change name into something else

here is code for grupa_select

I know, you already posted that. It was not what I asked for.

I want to know if you add my code above, what you see as output.

nope still same, error after pressing submit

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9752689/public_html/zadatak2/user.php on line 181

thats

while($row = mysql_fetch_array($pregled))

Resource id #11

its 11 just on page load, and after choosing band, its id 12 no matter which band I choose

and I have band with ID 14 only now in base, so idk where he pulls of 11 and 12

I heard that this mysql commands and version is old, and that might be a problem, I am suggest to use mysqli or pdo

should I change all my code on every php file or try to figure out this line only?

I am still looking for solution for mysql_fetch_array

if anyone can help I will appreciate