server A(192.168.1.3) mysql server(5.6.12) port 6603,socket /var/run/mysql/mysql.sock php(5.5.0) php.ini pdo_mysql.default_socket = /var/run/mysql/mysql.sock server B(192.168.1.4) mysql server(5.5….
Tag: mysql
Causes of MySQL error 2014 Cannot execute queries while other unbuffered queries are active
My server runs CentOS 6.4 with MySQL 5.1.69 installed using yum with CentOS’s repos, and PHP 5.4.16 installed using yum with ius’s repos. Edit3 Upgraded to MySQL Server version: 5.5.31 Distributed by The IUS Community Project, and error still exists. Then changed library to mysqlnd, and seems to e…
Difference between buffered and unbuffered queries
I was always under the impression the difference, in simple terms, between PHP/MySQL buffered and unbuffered queries is that buffered (the default) loads all the data into your results set variable and then you can start using them whereas unbuffered loads a row at a time. Say you ran SELECT * FROM sometable …
how to make a varchar nullable and unique together in mysql (laravel)
Can i make a MySQL column nullable and unique together. I have a table that store users Email_id if user wants to provide else it will be (null). I read in some other questions that i can make a unique field with default NULL. but i get this error when creating table the main table is generated with larave sc…
Convert SQL results into PHP array
I’m fairly new to PHP and I’ve been looking around and can’t seem to find the specific answer I’m looking for. I want to make a SQL query, such as this: Basically I want to take the entire contents of the result and create an array that I can access in a similar fashion as the row. For…
You have to wait x seconds to continue timestamp [closed]
I need a php & MySQL script which will do the following: User presses a button, insert into MySQL table a timestamp, if 60 minutes passed echo a text, if 60 minutes didn’t pass echo another text. …
jQuery Validate remote method usage to check if username already exists
I want to validate if username exists in database using jQuery.validate so here’s what I have so far: jQuery: check-username.php: This code always shows an error that the username is taken even if it’s not. I’m using jQuery Mobile 1.9.1 Thanks in advance. Answer I’ve managed to get thi…
Inserting data in MySQL table only if it doesn’t exist already: trouble with INSERT IGNORE
so I’ve been looking around StackOverflow and the MySQL manual for a while, and I can’t seem to solve my problem. What I’m trying to do is simply make my data INSERT function such that it doesn’t add anything to my table if it already exists. I saw a few methods: the INSERT IGNORE func…
WordPress database error MySQL server has gone away for query
I get this error so frequently that the php_error log file increases 1MB every 2 seconds. and the site is very slow. I have tried to add this line to wp-db.php but it did not help. The web server is IIS 7, latest version of mysql and wordpress Answer This trick will work for all WordPress versions. Open your …
Get insert_id for all rows inserted in single mysqli query (multiple values)
Working in PHP and using MYSQLI. Trying to get the insert_id for all rows inserted from a single insert query with multiple values. Keeping it in a single call for efficiency. My actual code has hundreds of values in one insert query. However, here is some sample code for an insert with just 4 values: The abo…