<?php
$connection = mysql_connect('localhost', 'jones.trenton', 'lolPassword');
mysql_select_db('jones.trenton');
$query = "SELECT * FROM computerparts";
$result = mysql_query($query);
echo "<table border='1'>
<tr>
<th>Part</th>
<th>In stock</th>
<th>Sold</th>
<th>Shipped</th>
<th>Returned</th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td>" . $row['Part'] . "</td><td>" . $row['In stock'] . "</td><td>" . $row['Sold'] . "</td><td>" . $row['Shipped'] . "</td><td>" . $row['Returned'] . "</td></tr>";
}
echo "</table>";
mysql_close();
?>
<doctype html>
<html>
<head>
<title>Add</title>
</head>
<body>
<form action="Jones-add.php" method="post">
Part Name: <input type="text" name="name">
# In Stock: <input type="text" name="stock">
# Sold: <input type="text" name="sold">
# Shipped: <input type="text" name="shipped">
# Returned: <input type="text" name="returned">
<input type="submit">
</form>
<?php
$con = mysql_connect('localhost', 'jones.trenton', 'lolPassword',"jones.trenton");
$name = $_POST['name'];
$stock = $_POST['stock'];
$sold = $_POST['sold'];
$shipped = $_POST['shipped'];
$returned = $_POST['returned'];
INSERT INTO `jones.trenton`.`computerparts` (`Part`, `In stock`, `Sold`, `Shipped`, `Returned`)
VALUES ($name, $stock, $sold, $shipped, $returned);
echo "1 record added";
mysql_close();
?>
</body>
</html>
- Output for 5.4.0 - 5.4.27
- Parse error: syntax error, unexpected 'INTO' (T_STRING) in /in/EsFQS on line 68
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected T_STRING in /in/EsFQS on line 68
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_STRING in /in/EsFQS on line 68
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/EsFQS on line 68
Process exited with code 255.
preferences:
206.14 ms | 1395 KiB | 117 Q