RE: [PHP-DB] php 4.0.5 to php 4.2.2
| From: | Peter Lovatt | Date: | Tue, 22 Apr 2003 07:33:56 +0000 |
| Subject: | RE: [PHP-DB] php 4.0.5 to php 4.2.2 | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27245@lists.php.net to get a copy of this message | ||
Is register_globals off in php.ini - if so, the variable $title won't
register.
Try $_POST["title"] or $HTTP_POST_VARS["title"]
HTH
Peter
-----Original Message-----
From: Chris Mach [mailto:cjmach@learn.senecac.on.ca]
Sent: 22 April 2003 07:48
To: php-db@lists.php.net
Subject: [PHP-DB] php 4.0.5 to php 4.2.2
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>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php