RE: [PHP-DEV] PHP 4.0 Bug #8890: Will not correctly update MySQL database when using WML and PHP and MySQL
Change '$(first)' to '$first' and change the other variables in the msyql_query() line in the same way. Sean > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 24, 2001 1:50 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DEV] PHP 4.0 Bug #8890: Will not correctly update MySQL > database when using WML and PHP and MySQL > > > From: [EMAIL PROTECTED] > Operating system: Windows 98 > PHP version: 4.0.4pl1 > PHP Bug Type: MySQL related > Bug description: Will not correctly update MySQL database > when using WML and PHP and MySQL > > I am trying to use a php script in a WML page to update a > MySQL database. Unfortunatley although it does create a new > row in the database it leave the values blank!! I have > included the code beneath!! I know that the variables are > being passed correctly because i have echoed the sql query > being sent to the database out to the screen and it seems to > be correct. I have included the WML code for each of the > pages below. I am running this on the Nokia SDK. The database > I created is named mydb and it is created with no rows! > > The following is register.php: > > // send wml headers > header("Content-type: text/vnd.wap.wml"); > echo ""; > echo ". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; > ?> > > > > > > > > > > > > > > First Name: > Last Name: > Address: > Position: > > > > > > > $db = mysql_connect("localhost", "root"); > > mysql_select_db("mydb",$db); > > $sql = "INSERT INTO employees (first,last,address,position) > VALUES ('$(first)','$(last)','$(address)','$(position)')"; > > $result = mysql_db_query ("mydb", $sql); > > echo "$sql"; > ?> > > > > > The following is register2.php: > > // send wml headers > header("Content-type: text/vnd.wap.wml"); > echo ""; > echo ". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; > ?> > > > > > > > > > > > > > > First Name: > Last Name: > Address: > Position: > > > > > > > $db = mysql_connect("localhost", "root"); > > mysql_select_db("mydb",$db); > > $sql = "INSERT INTO employees (first,last,address,position) > VALUES ('$(first)','$(last)','$(address)','$(position)')"; > > $result = mysql_db_query ("mydb", $sql); > > echo "$sql"; > ?> > > > > > // send wml headers > header("Content-type: text/vnd.wap.wml"); > echo ""; > echo ". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; > ?> > > > > > > > > > $db = mysql_connect("localhost", "root"); > mysql_select_db("mydb",$db); > $result = mysql_query("SELECT * FROM employees",$db); > printf("First Name: %s\n", mysql_result($result,0,"first")); > printf("Last Name: %s\n", mysql_result($result,0,"last")); > printf("Address: %s\n", mysql_result($result,0,"address")); > printf("Position: %s\n", mysql_result($result,0,"position")); > > > > > > When I run this it comes up on the WAP emulator as: > First Name: > Last Name: > Address: > Position: > and it should be > First Name: Kevin > Last Name: Connolly > Address: Somewhere > Position: Manager > > where Kevin, Connolly, Somewhere and manager are the values > entered into the input fields! > php scripts will work inside my WML pages which would suggest > I have everything installed properly but I have included my > php.ini file beneath anyway! > > php.ini: > [PHP] > > ;;; > ; About this file ; > ;;; > ; This file controls many aspects of PHP's behavior. In > order for PHP to > ; read it, it must be named 'php.ini'. PHP looks for it in > the current > ; working directory, in the path designated by the > environment variable > ; PHPRC, and in the path that was defined in compile time (in > that order). > ; Under Windows, the compile-time path is the Windows directory. The > ; path in which the php.ini file is
[PHP-DEV] PHP 4.0 Bug #8890: Will not correctly update MySQL database when using WML and PHP and MySQL
From: [EMAIL PROTECTED] Operating system: Windows 98 PHP version: 4.0.4pl1 PHP Bug Type: MySQL related Bug description: Will not correctly update MySQL database when using WML and PHP and MySQL I am trying to use a php script in a WML page to update a MySQL database. Unfortunatley although it does create a new row in the database it leave the values blank!! I have included the code beneath!! I know that the variables are being passed correctly because i have echoed the sql query being sent to the database out to the screen and it seems to be correct. I have included the WML code for each of the pages below. I am running this on the Nokia SDK. The database I created is named mydb and it is created with no rows! The following is register.php: "; echo "http://www.wapforum.org/DTD/wml_1.1.xml\">"; ?> First Name: Last Name: Address: Position: The following is register2.php: "; echo "http://www.wapforum.org/DTD/wml_1.1.xml\">"; ?> First Name: Last Name: Address: Position: "; echo "http://www.wapforum.org/DTD/wml_1.1.xml\">"; ?> ", mysql_result($result,0,"first")); printf("Last Name: %s\n", mysql_result($result,0,"last")); printf("Address: %s\n", mysql_result($result,0,"address")); printf("Position: %s\n", mysql_result($result,0,"position")); When I run this it comes up on the WAP emulator as: First Name: Last Name: Address: Position: and it should be First Name: Kevin Last Name: Connolly Address: Somewhere Position: Manager where Kevin, Connolly, Somewhere and manager are the values entered into the input fields! php scripts will work inside my WML pages which would suggest I have everything installed properly but I have included my php.ini file beneath anyway! php.ini: [PHP] ;;; ; About this file ; ;;; ; This file controls many aspects of PHP's behavior. In order for PHP to ; read it, it must be named 'php.ini'. PHP looks for it in the current ; working directory, in the path designated by the environment variable ; PHPRC, and in the path that was defined in compile time (in that order). ; Under Windows, the compile-time path is the Windows directory. The ; path in which the php.ini file is looked for can be overriden using ; the -c argument in command line mode. ; ; The syntax of the file is extremely simple. Whitespace and Lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e.g. [Foo]) are also silently ignored, even though ; they might mean something in the future. ; ; Directives are specified using the following syntax: ; directive = value ; Directive names are *case sensitive* - foo=bar is different from FOO=bar. ; ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one ; of the INI constants (On, Off, True, False, Yes, No and None) or an expression ; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo"). ; ; Expressions in the INI file are limited to bitwise operators and parentheses: ; | bitwise OR ; & bitwise AND ; ~ bitwise NOT ; ! boolean NOT ; ; Boolean flags can be turned on using the values 1, On, True or Yes. ; They can be turned off using the values 0, Off, False or No. ; ; An empty string can be denoted by simply not writing anything after the equal ; sign, or by using the None keyword: ; ; foo = ; sets foo to an empty string ; foo = none ; sets foo to an empty string ; foo = "none"; sets foo to the string 'none' ; ; If you use constants in your value, and these constants belong to a dynamically ; loaded extension (either a PHP extension or a Zend extension), you may only ; use these constants *after* the line that loads the extension. ; ; All the values in the php.ini-dist file correspond to the builtin ; defaults (that is, if no php.ini is used, or if you delete these lines, ; the builtin defaults will be identical). ; Language Options ; engine = On ; Enable the PHP scripting language engine under Apache short_open_tag = On ; allow the tags are recognized. asp_tags= Off ; allow ASP-style <% %> tags precision = 14 ; number of significant digits displayed in floating point numbers y2k_compliance = Off ; whether to be year 2000 compliant (will cause problems with non y2k compliant browsers) output_buffering= Off ; Output buffering allows you to send header lines (including cookies) ; even after you send body content, in the price of slowing PHP's