php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17865 Result and Input to Database in not working
Submitted: 2002-06-20 02:52 UTC Modified: 2002-06-24 12:55 UTC
From: stal at tm dot net dot my Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.2.1 OS: Linux Redhat 7.3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stal at tm dot net dot my
New email:
PHP Version: OS:

 

 [2002-06-20 02:52 UTC] stal at tm dot net dot my
I installed PHP 4.2.1 in DSO mode on Apache 1.3.24 and 1.3.26. It seems when I try to input or getting data from Mysql database, it does not seems to work well. The parse works fine without reporting error. But when viewing the data that been entered, it shows blank data been enter but it did uses up the field. When I reverse back to PHP 4.1.1 with the same module compiled and try the same procuder above, it works fine! Connection to mysql is fine, with no error. 

List of module compiled for both PHP:
./configure --prefix=/usr/webnew/php --with-apxs=/usr/webnew/apache/bin/apxs --with-mysql=/usr/web/mysql --with-pgsql=/usr/web/pgsql --with-imap=/usr/web/imap-2001a --enable-track-vars --with-gd --enable-ftp --enable-sysvsem --enable-sysvshm --enable-sockets --with-pdflib=/usr/web/pdflib --with-gettext --with-mm=/usr/lib --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib-dir=/usr/lib

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-20 02:54 UTC] derick@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
be off. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.
 [2002-06-22 12:51 UTC] stal at tm dot net dot my
I try to On the register_globals from php.ini but it still could not work on php 4.2.1? It is still the same. But php 4.1.1 works well with register_globals Off.
 [2002-06-22 13:17 UTC] imajes@php.net
can you give us a copy of the script that fails?
 [2002-06-23 04:11 UTC] stal at tm dot net dot my
Here is the scripts that I followed from a tutorials. Which is just a simple one for the test.

To input I create a datain.htm
<html>
<body>
<form method="post" action="../learn/datain.php">
        First Name:<input type="text" name="first"><br>
        Last Name:<input type="text" name="last"><br>
        Nick Name:<input type="text" name="nickname"><br>
        E-mail:<input type="text" name="email"><br>
        Salary:<input type="text" name="salary"><br>
        <input type="Submit" name="submit" value="Enter Information"></form>
</html>

Then for the processing would be datain.php
<html>
<?php

$db = mysql_connect("hostname", "username", "password") or exit("No connection");
        mysql_select_db("learn",$db) or exit("No database to connect");
        $sql = "INSERT INTO person (firstname, lastname, nick, email, salary) VAL
UES ('$first','$last','$nickname','$email','$salary
')";
        $result = mysql_query($sql);
        echo "Thank you! Information entered.\n";
?>
</html>

To view the data
<html>
<?php
$db = mysql_connect("hostname", "username", "password") or exit("Could not connect");
mysql_select_db("learn",$db) or exit ("Database not choosen");
$result = mysql_query("SELECT * FROM person",$db);
echo "<table>";
echo"<tr><td><b>Full Name:</b><td><b>Nick Name:</b><td><b>Salary:</b></tr>";
while ($myrow = mysql_fetch_array($result))
        {
        echo "<tr><td>";
        echo $myrow["firstname"];
        echo " ";
        echo $myrow["lastname"];
        echo "<td>";
        echo $myrow["nick"];
        echo "<td>";
        echo $myrow["salary"];
}
echo "</table>";
mysql_free_result ($result);
?>
</html>

Please guide!

Thanks
 [2002-06-23 05:18 UTC] derick@php.net
This is definitely the register_globals issue, you might to check with phpinfo() the path where PHP searches for your php.ini file and make sure you modified the correct one.
(phpinfo() also shows the settings of the register_globals directive, so you might want to check that too there).

Derick
 [2002-06-24 12:15 UTC] stal at tm dot net dot my
Okay, I got it fix. It is the php.ini file which is not in PATH. 

Thank you everyone!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 20:01:32 2025 UTC