Bug #18070 Updated: INSERT failure
| From: | sniper@php.net | Date: | Thu, 04 Jul 2002 13:09:31 +0000 |
| Subject: | Bug #18070 Updated: INSERT failure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13108@lists.php.net to get a copy of this message | ||
ID: 18070
Updated by: sniper@php.net
Reported By: Akujin11@yahoo.com
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: Windows XP
PHP Version: 4.2.0
New Comment:
Try changing that $PHP_SELF to $_SERVER['PHP_SELF']
as that didn't work..
Previous Comments:
------------------------------------------------------------------------
[2002-07-04 00:12:48] Akujin11@yahoo.com
thats the POINT. it doesn't work right. it can call data from my
database (so i know the connection works) but it refuses to insert
anything.
the source is as follows:
<html>
<head>
<title>Character Entry Form</title>
</head>
<body>
<?php
mysql_connect("localhost", "root") or die("Could not establish a
connection to the database.");
mysql_select_db("MvC2") or die("Could not select the given
database.");
function submit_values($char_name, $char_game, $char_alias) {
$insert_query = "INSERT INTO characters VALUES ('$char_name',
'$char_game', '$char_alias');";
mysql_query($insert_query) or die(mysql_error());
}
function results() {
?>
<table width=400 border=1>
<tr>
<td width=150>Name</td>
<td width=50>Game</td>
<td width=150>Alias</td>
</tr>
<?
$result_query = "SELECT * FROM characters ORDER BY name;";
$result_value = mysql_query($result_query) or die(mysql_error());
$x = 0;
while ($row = mysql_fetch_array($result_value)) {
if(($x % 2) == 0) { $c = "#cccccc"; }
else { $c = "#FFcccc"; }
?>
<tr>
<td bgcolor="<?= $c; ?>"><?= $row["name"]; ?></td>
<td bgcolor="<?= $c; ?>"><?= $row["game"]; ?></td>
<td bgcolor="<?= $c; ?>"><?= $row["c_alias"]; ?></td>
</tr>
<? $x++; } ?>
</table>
<?
}
function show_input() {
?>
<form method=post action="<?php $PHP_SELF ?>">
<table width=400 rules="none">
<tr>
<td>Name:</td>
<td><input type="text" name="character">
</tr>
<tr>
<td>Game:</td>
<td><input type="text" name="game">
</tr>
<tr>
<td>Alias:</td>
<td><input type="text" name="alias">
</tr>
<tr>
<td><input type="submit" name="submit" value="insert
character"></td>
<td><input type="reset" value="reset"></td>
</tr>
</table>
</form>
<?
}
if ($submit) {
$insert_query = "INSERT INTO characters VALUES ('Akuma', 'game',
'alias');";
mysql_query($insert_query) or die(mysql_error());
show_input();
results();
} else {
show_input();
results();
}
?>
</body>
</html>
see what you can make of it, but i'm telling you the problem lies not
with the code (which i personally wrote, and that worked untill my
upgrade), but insted with the new release. if you look at the number of
people that are having this same problem you will see that the evidence
does point that way.
------------------------------------------------------------------------
[2002-07-03 21:49:59] sniper@php.net
That example of yours doesn't work quite right..
Where's the source for it?
(the given url..)
------------------------------------------------------------------------
[2002-06-30 07:05:38] Akujin11@yahoo.com
i downloaded and installed 4.2.1 and it still does not work.
Here, see the file for yourself and see if you can add any input:
http://24.127.136.211/enter_char.php
------------------------------------------------------------------------
[2002-06-30 06:47:38] derick@php.net
Try the latest version (4.2.1) first
------------------------------------------------------------------------
[2002-06-30 05:03:22] Akujin11@yahoo.com
i have tried several methods of inserting rows and everything has
failed. the only way i can insert data is to open MySQL and insert it
manually thought the DOS prompt. i have noticed that a LOT of people
are having the same problem.
my setup is the same as it was before i upgraded, and the code is
exactly the same (i'm using the same, unmodified, file) and yet after
the upgrade my insert functions cease to work. a SELECT query does,
however, work.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/18070
--
Edit this bug report at http://bugs.php.net/?id=18070&edit=1