Hi all i'm newbie in this php and mysql coding
so can you plz help me
i'm using wamp server
and when i try to run the code there is an error pop up which say
PHP Code:
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 '' at line 1
here is my code
dropdown.php
data.php
i dont know where is the wrong so can you plz help
so can you plz help me
i'm using wamp server
and when i try to run the code there is an error pop up which say
PHP Code:
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 '' at line 1
here is my code
dropdown.php
Code:
<?php
$localhost="localhost";
$username="root";
$password="";
$database="e_cinema";
$linkid=mysql_connect($localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT MovieName,MovieID FROM movie";
$result = mysql_query ($query);
echo "<form name=MovieName method=post action='data.php'> <select MovieName=MovieName>Movie Name";
while($nt=mysql_fetch_array($result))
{
echo "<option value=$nt[MovieID]>$nt[MovieName]</option>";
} echo
"</select>";
echo " <input type=submit value=Submit name=button> </form>";
?>
data.php
Code:
<?php
$localhost="localhost";
$username="root";
$password="";
$database="e_cinema";
$linkid=mysql_connect($localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
if(isset($_POST['button']))
{
$MovieName= isset($_POST['MovieName']);
$query = "SELECT * FROM movie WHERE MovieName= $MovieName";
$result = mysql_query($query) or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>MovieID</th> <th>MovieName</th> <th>MovieRating</th> <th>Category</th> </tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr><td>";
echo $row['MovieID'];
echo "</td><td>";
echo $row['MovieName'];
echo "</td><td>";
echo $row['MovieRating'];
echo "</td><td>";
echo $row['Category'];
echo "</td></tr>";
} echo
"</table>";
}
else
{
}
?>
i dont know where is the wrong so can you plz help
Comment