if you would use
BBCode php tags, should be easier to see what is wrong
Those colors make sometimes VERY EASY to spot the point of error.
I try to re-post your code using BBcode
'php' .... '/php'
<html>
<body>
Welcome <?php echo $_POST["name"]; ?>.
<br/>
You are <?php echo $_POST["age"]; ?> years old.
<br/>
<?php
$con = mysql_connect("localhost","","");
if(!$con)
{
die('Could not connect: '.mysql_error());
}
mysql_select_db("oracle", $con);
$result = mysql_query("SELECT empno, ename FROM emp WHERE empno = '$_POST[empno]'");
while($row =mysql_fetch_array($result))
{
echo $row['empno'] . " and " . $row['ename'];
echo "<br />;
}
echo "good"; /* line 21 */
mysql_close($con);?>
</body>
</html>
it is easy to see, by the COLORS, that here is what goes wrong.
echo $row['empno'] . " and " . $row['ename'];
echo "<br />"; // missing end quote
}
echo "good";
mysql_close($con);?>
</body>
</html>
===================================
Actually, you can use this board for DEBUG.
- You click REPLY to some Topic here.
- You add your code with php - /php tags around
- Click Preview Post
- You can start study your script in COLORS.
- Maybe find the bug.
Then you do not have to submit 'your Reply'
🙂