Bug #17865 Updated: Result and Input to Database in not working

From: Date: Sun, 23 Jun 2002 09:18:34 +0000
Subject: Bug #17865 Updated: Result and Input to Database in not working
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11824@lists.php.net to get a copy of this message
ID: 17865 Updated by: derick@php.net Reported By: stal@tm.net.my -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Linux Redhat 7.3 PHP Version: 4.2.1 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2002-06-23 04:11:07] stal@tm.net.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-22 13:17:28] imajes@php.net can you give us a copy of the script that fails? ------------------------------------------------------------------------ [2002-06-22 12:51:46] stal@tm.net.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-20 02:54:55] 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-20 02:52:11] stal@tm.net.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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17865&edit=1

« previous php.bugs (#11824) next »