Hi,

The variable $q=$_GET["q"]; is passing correctly the value "q" to the $query and echoing the . $row['YEAR'] .

HOWEVER, it is not working with the while statement IN THE SAME CODE.

PHP Code:
while ($rows $result2->fetch_array())

{
$row0 [] = $rows['YEAR'];            
$row1 [] = $rows['MONTH'];        
$row2 [] = $rows['SALES'];

IF I try to type directly the value after the $_GET it does work ( $q=2013; for example )

Can anyone gime a help to make the while statement work with $q=$_GET["q"];

Bellow is the complete code.

Appreciate any help

PHP Code:
<?php
$q
=$_GET["q"];

$mysqli = new mysqli('localhost','user','pswd','database');


/* check connection */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();    
}

$query "SELECT * FROM table_test WHERE `YEAR`='".$q."'";

$result $mysqli->query($query);

if (
$row $result->fetch_array())

{
  echo 
"<td>" $row['YEAR'] . "</td>";

  }    

$result2 $mysqli->query($query);

while (
$rows $result2->fetch_array())

{
$row0 [] = $rows['YEAR'];            
$row1 [] = $rows['MONTH'];        
$row2 [] = $rows['SALES'];
}    
    


    
/* free result set */
    
$result->close();


$mysqli->close();

?>