php 4.0.5 to php 4.2.2
| From: | Chris Mach | Date: | Tue, 22 Apr 2003 06:47:50 +0000 |
| Subject: | php 4.0.5 to php 4.2.2 | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27243@lists.php.net to get a copy of this message | ||
I originally wrote some php scripts (php 4.0.5) which would update my mysql
database. Now i need to move to a different server (php 4.2.2) and now i
can't get my INSERT query to work now. Is there something i don't know about
upgrading versions of php?
<html>
<body>
<?php
$host="www.freesql.org";
$user="***";
$password="********";
//Connect and select the database for use
$db = mysql_connect($host,$user,$password) or die("Could not connect: " .
mysql_error());
mysql_select_db("55yardline",$db);
$result = mysql_query("SELECT * FROM news WHERE id < 50",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=0 width=600 align=center>\n";
echo "<tr><td>News</td></tr>\n";
do
{
printf("<tr><td><b>%s</b></td></tr><tr><td>%s<br><br><br><br></td></tr>\n",
$myrow["title"], $myrow["copy"]);
}
while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
}
else
{
echo "Sorry, no records were found!";
}
if ($submit) {
$sql = "INSERT INTO news (title,copy) VALUES
('$title','shit')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
?>
<form method="post" action="<?php echo $PHP_SELF?>">
Enter Data:<textarea name="title" cols="75"
rows="10"></textarea>
<input type="Submit" name="submit" value="Enter
information">
</form>
<?php
}
?>
</body>
</html>