Bug #18070 Updated: INSERT failure
| From: | sniper@php.net | Date: | Fri, 05 Jul 2002 08:05:49 +0000 |
| Subject: | Bug #18070 Updated: INSERT failure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13183@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:
Please check your script, and especially those warnings/errors that
come when you load it..
It's still sending the post to wrong script.
Previous Comments:
------------------------------------------------------------------------
[2002-07-05 02:35:19] Akujin11@yahoo.com
i made the change you suggested, it still refuses to add data.
by the way, the Akuma you see there is from my database, so you can see
that the connection is working.
------------------------------------------------------------------------
[2002-07-04 09:09:31] sniper@php.net
Try changing that $PHP_SELF to $_SERVER['PHP_SELF']
as that didn't work..
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
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