Jump to content

Recommended Posts

After a ton of trial and error and searching and searching for the answer, I have finally resorted to posting to ask for help.  I am very new to php so please bear with me.

 

I have been building an employee training database at work.  Basically to make sure that for example we have the current drivers liscense on file for those employees who drive and have gone through the required company training.  I initially built an access database with a frontend that does everything needed. However, the company is very decentralized and we have several users who would regularly need access to the information when they are offsite.  The database does work offsite however it is extremely slow.  After purchasing a buffalo linkstation, I discovered it has the capability for a mysql server.  

 

I have been able to migrate the data over to the mysql server and build a simple read only php form but cant get the changes you make to update back into the database.

 

I found a method of fetching the data using json that is based on a drop down selection, upon change, it goes and gets the correct data.

<script type="text/javascript">
      function insertResults(json){
		$("#Separated").val(json["Separated"]);
		$("#id").val(json["id"]);
        $("#Employee_ID").val(json["Employee_ID"]);
        $("#Last_Name").val(json["Last_Name"]);
        $("#First_Name").val(json["First_Name"]);
        $("#Date_Of_Birth").val(json["Date_Of_Birth"]);
        $("#Original_Hire_Date").val(json["Original_Hire_Date"]);
        $("#Current_Hire_Date").val(json["Current_Hire_Date"]);

However, lets say you correct a mis-spelling in their name, I cant seem to write back to the db.  I have a submit button that uses this code

<a href="InputFormSubmit.php?id=<?php echo $rows['id']; ?>"><input type="submit" name="submit2" value="Submit"></a>

But I guess I cant seem to #1 completely grasp how to pass on the selected information using POST (correct?) to the next form "InputFormSubmit" and #2 correctly build the query for it?  Code for it below:

<?php

 		include_once('db.php');
		$Employee_ID  = $_POST['Employee_ID'];
		$Last_Name = $_POST['Last_Name'];
		$First_Name = $_POST['First_Name'];
		$id=$_POST['id'];
		echo "$id";

		echo "$Employee_ID";
	// update data in mysql database


	$con=mysql_connect("localhost","usernamegoeshere","passwordgoeshere","databasenamegoeshere");
	// Check connection

	mysql_query("UPDATE tbl_Employee_Master SET Last_Name='$Last_Name', First_Name='$First_Name' WHERE id='$id'");

	mysql_close($con);
?>

The proper EmployeeID is passed from the previous form into this one, but the query dies I guess.

 

What I would like to do is pass the updated info into InputFormSubmit and then run the query and redirect back to the search page. Potentially passing back the employee ID and setting the drop down to that value so you would see the employees file you just updated again.

 

Super long post, thanks for any direction anyone can give me, Im sure my code looks awful from trying a thousand different things.

 

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/
Share on other sites

the msyql_connect() statement you posted is incorrect. the 4th parameter is NOT the database name. it's a flag the controls if a new connection is made if an existing connection with the same credentials already exists.

 

however, you should not be using mysql_ functions as they are depreciated, should not be used for new code, and will be removed in a future version of php. you should be using either the msyqli_ or PDO database library functions. if you were using mysqli_connect(), the 4th parameter is the database name and your code would then be closer to running.

 

does your development system you have php's error_reporting set to E_ALL and display_errors set to ON so that php would report and display all the errors it detects? you also need to test if queries work or not. for development you would display any query errors, on the live server you would log any database errors.

 

lastly, the posted php code has no security to limit who can post data to it and no protection against sql injection. it's not even testing if a form was submitted before trying to use the $_POST form data values. all of these things are needed if this is more than just a classroom assignment for learning purposes that won't ever be on a live server.

Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/#findComment-1490856
Share on other sites

I believe my version of php does not have the mysqli, being as the php server is running on a buffalo linkstation, i cannot add in the functionality without hacking it to which i was told not to do (cant say i blame them for that). I know its an older version but its what ive got right now.

 

in terms of the security, it will be behind a vpn so the access will be limited from that standpoint but I am still planning on adding in more but again this more a proof of concept right now so that i can move forward.

 

not sure if this would help but this is my phpinfo


PHP Logo
PHP Version 5.2.10-pl0-gentoo


System	Linux ShareDrive 3.3.4-88f6281 #1 Tue Jul 9 14:48:53 JST 2013 armv5tel
Build Date	Aug 7 2009 12:32:02
Configure Command	'./configure' '--prefix=/usr/lib/php5' '--host=arm-softfloat-linux-gnueabi' '--mandir=/usr/lib/php5/man' '--infodir=/usr/lib/php5/info' '--sysconfdir=/etc' '--cache-file=./config.cache' '--with-pcre-regex=/usr' '--enable-maintainer-zts' '--disable-cli' '--enable-cgi' '--enable-fastcgi' '--disable-discard-path' '--disable-force-cgi-redirect' '--with-config-file-path=/etc/php/cgi-php5' '--with-config-file-scan-dir=/etc/php/cgi-php5/ext-active' '--without-pear' '--disable-bcmath' '--with-bz2' '--disable-calendar' '--with-curl' '--with-curlwrappers' '--disable-dbase' '--enable-exif' '--without-fbsql' '--without-fdftk' '--enable-ftp' '--with-gettext' '--without-gmp' '--disable-ipv6' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--without-mhash' '--without-msql' '--without-mssql' '--without-ncurses' '--with-openssl' '--with-openssl-dir=/usr' '--disable-pcntl' '--without-pgsql' '--without-pspell' '--without-recode' '--disable-shmop' '--without-snmp' '--disable-soap' '--enable-sockets' '--without-sybase' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--without-tidy' '--disable-wddx' '--with-xmlrpc' '--with-xsl' '--enable-zip' '--with-zlib' '--disable-debug' '--without-cdb' '--without-db4' '--disable-flatfile' '--without-gdbm' '--disable-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--enable-gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--without-mysqli' '--without-pdo-dblib' '--with-pdo-mysql=/usr' '--without-pdo-odbc' '--without-pdo-pgsql' '--with-pdo-sqlite=/usr' '--without-readline' '--without-libedit' '--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8'
Server API	CGI/FastCGI
Virtual Directory Support	enabled
Configuration File (php.ini) Path	/etc/php/cgi-php5
Loaded Configuration File	/etc/php/cgi-php5/php.ini
Scan this dir for additional .ini files	/etc/php/cgi-php5/ext-active
additional .ini files parsed	/etc/php/cgi-php5/ext-active/eaccelerator.ini
PHP API	20041225
PHP Extension	20060613
Zend Extension	220060519
Debug Build	no
Thread Safety	enabled
Zend Memory Manager	enabled
IPv6 Support	disabled
Registered PHP Streams	https, ftps, compress.zlib, compress.bzip2, tftp, ftp, telnet, dict, http, file, php, data, zip
Registered Stream Socket Transports	tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters	zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

PHP Credits

Configuration

PHP Core

Directive	Local Value	Master Value
allow_call_time_pass_reference	On	On
allow_url_fopen	Off	Off
allow_url_include	Off	Off
always_populate_raw_post_data	Off	Off
arg_separator.input	&	&
arg_separator.output	&	&
asp_tags	Off	Off
auto_append_file	no value	no value
auto_globals_jit	On	On
auto_prepend_file	no value	no value
browscap	no value	no value
default_charset	no value	no value
default_mimetype	text/html	text/html
define_syslog_variables	Off	Off
disable_classes	no value	no value
disable_functions	no value	no value
display_errors	On	On
display_startup_errors	Off	Off
doc_root	no value	no value
docref_ext	no value	no value
docref_root	no value	no value
enable_dl	On	On
error_append_string	no value	no value
error_log	no value	no value
error_prepend_string	no value	no value
error_reporting	6135	6135
expose_php	On	On
extension_dir	/usr/lib/php5/lib/php/extensions/no-debug-zts-20060613	/usr/lib/php5/lib/php/extensions/no-debug-zts-20060613
file_uploads	On	On
highlight.bg	#FFFFFF	#FFFFFF
highlight.comment	#FF8000	#FF8000
highlight.default	#0000BB	#0000BB
highlight.html	#000000	#000000
highlight.keyword	#007700	#007700
highlight.string	#DD0000	#DD0000
html_errors	On	On
ignore_repeated_errors	Off	Off
ignore_repeated_source	Off	Off
ignore_user_abort	Off	Off
implicit_flush	Off	Off
include_path	.:/usr/share/php5:/usr/share/php	.:/usr/share/php5:/usr/share/php
log_errors	Off	Off
log_errors_max_len	1024	1024
magic_quotes_gpc	On	On
magic_quotes_runtime	Off	Off
magic_quotes_sybase	Off	Off
mail.force_extra_parameters	no value	no value
max_execution_time	30	30
max_input_nesting_level	64	64
max_input_time	60	60
memory_limit	128M	128M
open_basedir	no value	no value
output_buffering	no value	no value
output_handler	no value	no value
post_max_size	8M	8M
precision	12	12
realpath_cache_size	16K	16K
realpath_cache_ttl	120	120
register_argc_argv	On	On
register_globals	Off	Off
register_long_arrays	On	On
report_memleaks	On	On
report_zend_debug	On	On
safe_mode	Off	Off
safe_mode_exec_dir	no value	no value
safe_mode_gid	Off	Off
safe_mode_include_dir	no value	no value
sendmail_from	no value	no value
sendmail_path	/usr/sbin/sendmail -t -i 	/usr/sbin/sendmail -t -i 
serialize_precision	100	100
short_open_tag	On	On
SMTP	localhost	localhost
smtp_port	25	25
sql.safe_mode	Off	Off
track_errors	Off	Off
unserialize_callback_func	no value	no value
upload_max_filesize	2M	2M
upload_tmp_dir	no value	no value
user_dir	no value	no value
variables_order	EGPCS	EGPCS
xmlrpc_error_number	0	0
xmlrpc_errors	Off	Off
y2k_compliance	On	On
zend.ze1_compatibility_mode	Off	Off

bz2

BZip2 Support	Enabled
Stream Wrapper support	compress.bz2://
Stream Filter support	bzip2.decompress, bzip2.compress
BZip2 Version	1.0.5, 10-Dec-2007

cgi-fcgi

Directive	Local Value	Master Value
cgi.check_shebang_line	1	1
cgi.fix_pathinfo	1	1
cgi.nph	0	0
cgi.rfc2616_headers	0	0
fastcgi.logging	1	1

ctype

ctype functions	enabled

curl

cURL support	enabled
cURL Information	libcurl/7.19.6 OpenSSL/0.9.8i zlib/1.2.3

date

date/time support	enabled
"Olson" Timezone Database Version	2009.9
Timezone Database	internal
Default timezone	America/Chicago

Directive	Local Value	Master Value
date.default_latitude	31.7667	31.7667
date.default_longitude	35.2333	35.2333
date.sunrise_zenith	90.583333	90.583333
date.sunset_zenith	90.583333	90.583333
date.timezone	no value	no value

dom

DOM/XML	enabled
DOM/XML API Version	20031129
libxml Version	2.7.3
HTML Support	enabled
XPath Support	enabled
XPointer Support	enabled
Schema Support	enabled
RelaxNG Support	enabled

eAccelerator

eAccelerator support	enabled
Version	0.9.5.3
Caching Enabled	true
Optimizer Enabled	true
Memory Size	29,360,096 Bytes
Memory Available	20,420,504 Bytes
Memory Allocated	8,939,592 Bytes
Cached Scripts	134
Removed Scripts	0
Cached Keys	0

Directive	Local Value	Master Value
eaccelerator.allowed_admin_path	no value	no value
eaccelerator.cache_dir	/var/cache/eaccelerator-php5/	/var/cache/eaccelerator-php5/
eaccelerator.check_mtime	1	1
eaccelerator.compress	0	0
eaccelerator.compress_level	9	9
eaccelerator.content	shm_and_disk	shm_and_disk
eaccelerator.debug	0	0
eaccelerator.enable	1	1
eaccelerator.filter	no value	no value
eaccelerator.keys	shm_and_disk	shm_and_disk
eaccelerator.log_file	no value	no value
eaccelerator.name_space	no value	no value
eaccelerator.optimizer	1	1
eaccelerator.sessions	shm_and_disk	shm_and_disk
eaccelerator.shm_max	0	0
eaccelerator.shm_only	0	0
eaccelerator.shm_prune_period	0	0
eaccelerator.shm_size	28	28
eaccelerator.shm_ttl	0	0

exif

EXIF Support	enabled
EXIF Version	1.4 $Id: exif.c,v 1.173.2.5.2.28 2009/05/28 14:03:09 pajoye Exp $
Supported EXIF Version	0220
Supported filetypes	JPEG,TIFF

filter

Input Validation and Filtering	enabled
Revision	$Revision: 1.52.2.47 $

Directive	Local Value	Master Value
filter.default	unsafe_raw	unsafe_raw
filter.default_flags	no value	no value

ftp

FTP support	enabled

gd

GD Support	enabled
GD Version	bundled (2.0.34 compatible)
FreeType Support	enabled
FreeType Linkage	with freetype
FreeType Version	2.3.9
T1Lib Support	enabled
GIF Read Support	enabled
GIF Create Support	enabled
JPG Support	enabled
PNG Support	enabled
WBMP Support	enabled
XBM Support	enabled
JIS-mapped Japanese Font Support	enabled

gettext

GetText Support	enabled

hash

hash support	enabled
Hashing Engines	md2 md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5

iconv

iconv support	enabled
iconv implementation	glibc
iconv library version	2.5

Directive	Local Value	Master Value
iconv.input_encoding	ISO-8859-1	ISO-8859-1
iconv.internal_encoding	ISO-8859-1	ISO-8859-1
iconv.output_encoding	ISO-8859-1	ISO-8859-1

json

json support	enabled
json version	1.2.1

libxml

libXML support	active
libXML Version	2.7.3
libXML streams	enabled

mbstring

Multibyte Support	enabled
Multibyte string engine	libmbfl
Multibyte (japanese) regex support	enabled
Multibyte regex (oniguruma) version	4.4.4
Multibyte regex (oniguruma) backtrack check	On

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

Directive	Local Value	Master Value
mbstring.detect_order	no value	no value
mbstring.encoding_translation	Off	Off
mbstring.func_overload	0	0
mbstring.http_input	pass	pass
mbstring.http_output	pass	pass
mbstring.internal_encoding	no value	no value
mbstring.language	neutral	neutral
mbstring.strict_detection	Off	Off
mbstring.substitute_character	no value	no value

mcrypt

mcrypt support	enabled
Version	2.5.8
Api No	20021217
Supported ciphers	cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes	cbc cfb ctr ecb ncfb nofb ofb stream

Directive	Local Value	Master Value
mcrypt.algorithms_dir	no value	no value
mcrypt.modes_dir	no value	no value

mysql

MySQL Support	enabled
Active Persistent Links	0
Active Links	0
Client API version	5.0.70
MYSQL_MODULE_TYPE	external
MYSQL_SOCKET	/var/run/mysqld/mysqld.sock
MYSQL_INCLUDE	-I/usr/include/mysql
MYSQL_LIBS	-L/usr/lib -lmysqlclient_r

Directive	Local Value	Master Value
mysql.allow_persistent	On	On
mysql.connect_charset	no value	no value
mysql.connect_timeout	60	60
mysql.default_host	no value	no value
mysql.default_password	no value	no value
mysql.default_port	no value	no value
mysql.default_socket	no value	no value
mysql.default_user	no value	no value
mysql.max_links	Unlimited	Unlimited
mysql.max_persistent	Unlimited	Unlimited
mysql.trace_mode	Off	Off

openssl

OpenSSL support	enabled
OpenSSL Version	OpenSSL 0.9.8k 25 Mar 2009

pcre

PCRE (Perl Compatible Regular Expressions) Support	enabled
PCRE Library Version	7.9 2009-04-11

Directive	Local Value	Master Value
pcre.backtrack_limit	100000	100000
pcre.recursion_limit	100000	100000

PDO

PDO support	enabled
PDO drivers	sqlite, mysql, sqlite2

pdo_mysql

PDO Driver for MySQL, client library version	5.0.70

Directive	Local Value	Master Value
pdo_mysql.connect_charset	no value	no value

pdo_sqlite

PDO Driver for SQLite 3.x	enabled
PECL Module version	1.0.1 $Id: pdo_sqlite.c,v 1.10.2.6.2.4 2008/12/31 11:17:42 sebastian Exp $
SQLite Library	3.6.14.2

posix

Revision	$Revision: 1.70.2.3.2.22 $

Reflection

Reflection	enabled
Version	$Id: php_reflection.c,v 1.164.2.33.2.57 2009/05/21 16:05:11 lbarnaud Exp $

session

Session Support	enabled
Registered save handlers	files user sqlite eaccelerator
Registered serializer handlers	php php_binary

Directive	Local Value	Master Value
session.auto_start	Off	Off
session.bug_compat_42	On	On
session.bug_compat_warn	On	On
session.cache_expire	180	180
session.cache_limiter	nocache	nocache
session.cookie_domain	no value	no value
session.cookie_httponly	Off	Off
session.cookie_lifetime	0	0
session.cookie_path	/	/
session.cookie_secure	Off	Off
session.entropy_file	no value	no value
session.entropy_length	0	0
session.gc_divisor	100	100
session.gc_maxlifetime	1440	1440
session.gc_probability	1	1
session.hash_bits_per_character	4	4
session.hash_function	0	0
session.name	PHPSESSID	PHPSESSID
session.referer_check	no value	no value
session.save_handler	files	files
session.save_path	no value	no value
session.serialize_handler	php	php
session.use_cookies	On	On
session.use_only_cookies	Off	Off
session.use_trans_sid	0	0

SimpleXML

Simplexml support	enabled
Revision	$Revision: 1.151.2.22.2.46 $
Schema support	enabled

sockets

Sockets Support	enabled

SPL

SPL support	enabled
Interfaces	Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes	AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RegexIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

SQLite

SQLite support	enabled
PECL Module version	2.0-dev $Id: sqlite.c,v 1.166.2.13.2.12 2008/12/31 11:17:44 sebastian Exp $
SQLite Library	2.8.16
SQLite Encoding	UTF-8

Directive	Local Value	Master Value
sqlite.assoc_case	0	0

standard

Regex Library	Bundled library enabled
Dynamic Library Support	enabled
Path to sendmail	/usr/sbin/sendmail -t -i

Directive	Local Value	Master Value
assert.active	1	1
assert.bail	0	0
assert.callback	no value	no value
assert.quiet_eval	0	0
assert.warning	1	1
auto_detect_line_endings	0	0
default_socket_timeout	60	60
safe_mode_allowed_env_vars	PHP_	PHP_
safe_mode_protected_env_vars	LD_LIBRARY_PATH	LD_LIBRARY_PATH
url_rewriter.tags	a=href,area=href,frame=src,input=src,form=,fieldset=	a=href,area=href,frame=src,input=src,form=,fieldset=
user_agent	no value	no value

tokenizer

Tokenizer Support	enabled

xml

XML Support	active
XML Namespace Support	active
libxml2 Version	2.7.3

xmlreader

XMLReader	enabled

xmlrpc

core library version	xmlrpc-epi v. 0.51
php extension version	0.51
author	Dan Libby
homepage	http://xmlrpc-epi.sourceforge.net
open sourced by	Epinions.com

xmlwriter

XMLWriter	enabled

xsl

XSL	enabled
libxslt Version	1.1.24
libxslt compiled against libxml Version	2.7.3
EXSLT	enabled
libexslt Version	1.1.24

zip

Zip	enabled
Extension Version	$Id: php_zip.c,v 1.1.2.50 2009/03/01 17:35:25 iliaa Exp $
Zip version	1.8.11
Libzip version	0.9.0

zlib

ZLib Support	enabled
Stream Wrapper support	compress.zlib://
Stream Filter support	zlib.inflate, zlib.deflate
Compiled Version	1.2.3
Linked Version	1.2.3

Directive	Local Value	Master Value
zlib.output_compression	Off	Off
zlib.output_compression_level	-1	-1
zlib.output_handler	no value	no value

Additional Modules

Module Name

Environment

Variable	Value
TERM	vt102
SHELL	/bin/sh
USER	root
PATH	/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
PWD	/
HOME	/
SHLVL	4
BOOTVER	0.26
_	/sbin/start-stop-daemon
PHP_FCGI_CHILDREN	1

PHP Variables

Variable	Value
_REQUEST["PHPSESSID"]	0ebf917700973867986ebee74478c6c6
_COOKIE["PHPSESSID"]	0ebf917700973867986ebee74478c6c6
_SERVER["TERM"]	vt102
_SERVER["SHELL"]	/bin/sh
_SERVER["USER"]	root
_SERVER["PATH"]	/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
_SERVER["PWD"]	/
_SERVER["HOME"]	/
_SERVER["SHLVL"]	4
_SERVER["BOOTVER"]	0.26
_SERVER["_"]	/sbin/start-stop-daemon
_SERVER["PHP_FCGI_CHILDREN"]	1
_SERVER["FCGI_ROLE"]	RESPONDER
_SERVER["SERVER_SOFTWARE"]	lighttpd/1.4.32
_SERVER["SERVER_NAME"]	192.168.68.109
_SERVER["GATEWAY_INTERFACE"]	CGI/1.1
_SERVER["SERVER_PORT"]	81
_SERVER["SERVER_ADDR"]	192.168.68.109
_SERVER["REMOTE_PORT"]	51261
_SERVER["REMOTE_ADDR"]	192.168.68.104
_SERVER["SCRIPT_NAME"]	/phpconfig.php
_SERVER["PATH_INFO"]	no value
_SERVER["SCRIPT_FILENAME"]	/mnt/array1/WebServer/htdocs/phpconfig.php
_SERVER["DOCUMENT_ROOT"]	/mnt/array1/WebServer/htdocs/
_SERVER["REQUEST_URI"]	/phpconfig.php
_SERVER["QUERY_STRING"]	no value
_SERVER["REQUEST_METHOD"]	GET
_SERVER["REDIRECT_STATUS"]	200
_SERVER["SERVER_PROTOCOL"]	HTTP/1.1
_SERVER["HTTP_HOST"]	192.168.68.109:81
_SERVER["HTTP_CONNECTION"]	keep-alive
_SERVER["HTTP_ACCEPT"]	text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
_SERVER["HTTP_USER_AGENT"]	Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
_SERVER["HTTP_DNT"]	1
_SERVER["HTTP_ACCEPT_ENCODING"]	gzip,deflate,sdch
_SERVER["HTTP_ACCEPT_LANGUAGE"]	en-US,en;q=0.8
_SERVER["HTTP_COOKIE"]	PHPSESSID=0ebf917700973867986ebee74478c6c6
_SERVER["PHP_SELF"]	/phpconfig.php
_SERVER["REQUEST_TIME"]	1410535374
_SERVER["argv"]	
Array
(
)
_SERVER["argc"]	0
_ENV["TERM"]	vt102
_ENV["SHELL"]	/bin/sh
_ENV["USER"]	root
_ENV["PATH"]	/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
_ENV["PWD"]	/
_ENV["HOME"]	/
_ENV["SHLVL"]	4
_ENV["BOOTVER"]	0.26
_ENV["_"]	/sbin/start-stop-daemon
_ENV["PHP_FCGI_CHILDREN"]	1
_ENV["FCGI_ROLE"]	RESPONDER
_ENV["SERVER_SOFTWARE"]	lighttpd/1.4.32
_ENV["SERVER_NAME"]	192.168.68.109
_ENV["GATEWAY_INTERFACE"]	CGI/1.1
_ENV["SERVER_PORT"]	81
_ENV["SERVER_ADDR"]	192.168.68.109
_ENV["REMOTE_PORT"]	51261
_ENV["REMOTE_ADDR"]	192.168.68.104
_ENV["SCRIPT_NAME"]	/phpconfig.php
_ENV["PATH_INFO"]	no value
_ENV["SCRIPT_FILENAME"]	/mnt/array1/WebServer/htdocs/phpconfig.php
_ENV["DOCUMENT_ROOT"]	/mnt/array1/WebServer/htdocs/
_ENV["REQUEST_URI"]	/phpconfig.php
_ENV["QUERY_STRING"]	no value
_ENV["REQUEST_METHOD"]	GET
_ENV["REDIRECT_STATUS"]	200
_ENV["SERVER_PROTOCOL"]	HTTP/1.1
_ENV["HTTP_HOST"]	192.168.68.109:81
_ENV["HTTP_CONNECTION"]	keep-alive
_ENV["HTTP_ACCEPT"]	text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
_ENV["HTTP_USER_AGENT"]	Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
_ENV["HTTP_DNT"]	1
_ENV["HTTP_ACCEPT_ENCODING"]	gzip,deflate,sdch
_ENV["HTTP_ACCEPT_LANGUAGE"]	en-US,en;q=0.8
_ENV["HTTP_COOKIE"]	PHPSESSID=0ebf917700973867986ebee74478c6c6

PHP License

This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.

Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/#findComment-1490861
Share on other sites

It's most likely on your server but just not enabled. Look in your php.ini in the extensions section and look for

;extension=php_mysqli.so (or .dll if windows)

remove the ; from the front of the line and restart apache.

Edited by CroNiX
Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/#findComment-1490864
Share on other sites

This version of php is not compiled with mysqli support, but you've got a better one - pdo. Use pdo as your default database library.

 

PDO is already there, and quite frankly most people prefer PDO anyways as the syntax is more flexible.

Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/#findComment-1490875
Share on other sites

This version of php is not compiled with mysqli support, but you've got a better one - pdo. Use pdo as your default database library.

thanks! I have the ability to write back now, confirmed its working.

 

Is it bad/frowned upon to have data fetched via ajex/json and then written back to the database via pdo? could it not be fetched via pdo in an array(i hope I am using that term correctly), if its edited then the array as a whole gets written back? this could save me a ton of time scripting and allow for future additions pretty easily I think.  The only individual item would be a timestamp

Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/#findComment-1490884
Share on other sites

Json as far as I know is supported in MySQL, but in the newer versions.I was using json to insert data by Javascript only once to one noSQL database - MongoDB,  not too much experience with it. What MySQL version does the host provide you?

Edited by jazzman1
Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/#findComment-1490900
Share on other sites

Is it bad/frowned upon to have data fetched via ajex/json and then written back to the database via pdo? could it not be fetched via pdo in an array(i hope I am using that term correctly), if its edited then the array as a whole gets written back? this could save me a ton of time scripting and allow for future additions pretty easily I think.  The only individual item would be a timestamp

 

 

you have to present the data in a meaningful form (no pun intended) in the client/browser, so, there needs to be some structure.

 

however, what you have shown in this thread is a basic CRUD (Create, Read, Update, Delete) application. this can be coded general purpose, where all you do is define what database table(s) you want, what fields to include/exclude, and everything else can be handled by the code, using array variables/array functions, without writing out specific code for each field name. here's one such application that i know of - http://www.phpmyedit.org/

Link to comment
https://forums.phpfreaks.com/topic/291016-update-query-help/#findComment-1490901
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.