what's wrong with my coding?please help.

<?php
		$a= $_POST['ques'];
		$sql="SELECT * FROM $question WHERE question=$a";
		$query=mysql_fetch_array($sql);
		while($result=mysql_fetch_array($query)){
		
		$result['id'];
		}
?>

or this one

<?php
		$sql="SELECT * FROM $question WHERE question='".$_POST['ques']."'";
		$query=mysql_fetch_array($sql);
		while($result=mysql_fetch_array($query)){
		
		$result['id'];
		}
?>

In both you need to use mysql_query:

$query=mysql_query($sql);
commented: that's exactly it +5

As cereal says, you need to actually run the query using mysql_query as follows:

$sql=mysql_query("SELECT * FROM $question WHERE question=$a");
		$query=mysql_fetch_array($sql);
Member Avatar

how about using an echo?

$result['id'];

to

echo $result['id'];