Professional Hypertext Preprocessor, a widely used platform for dynamic web applications.
9
votes
1answer
152 views
Calculate MATCH() AGAINST() scores from UNIFIED QUERY not FOR EACH TABLE
I am trying to have a score for entire section of SELECT statements
SELECT *,MATCH(`result`) AGAINST('keyword') as `score` FROM `table1` WHERE MATCH(`result`) AGAINST('keyword')
UNION
SELECT ...
6
votes
1answer
255 views
Application Settings in Database
In the past I have stored all generic settings and configuration items such as: custom application title, home address, version, debug, etc.. all in a "settings.php" file that I would include into all ...
5
votes
3answers
521 views
InnoDB Master-Master replication goes inconsistant after power failure tests
Afternoon gents,
I'm currently stress testing a Master-Master replication setup using InnoDB as database engine.
We're using this simple script for testing which we run in Linux CLI from a remote ...
4
votes
6answers
21k views
importing large SQL file phpmyadmin
I am trying to import this SQL file in phpmyadmin and got this message
#1064 - You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right ...
4
votes
2answers
19k views
How to resolve too many connections and fatal error in mysql running on vps
I am running an application PHPlist on my linode server, simultaneously running 12 php scripts which open mysql connection, now when i access phplist it shows lot of times an error shows:
Fatal ...
4
votes
1answer
1k views
MySQL 'LOAD DATA INFILE' : Can't replace entry when foreign key exists
Here's a minimal case for my database scheme:
CREATE TABLE `test` (
`id` int(11) NOT NULL,
`name` varchar(22) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT ...
4
votes
1answer
112 views
mysql_connect() system error :111
I have 2 VPS.
I would like to connect from the frist to the second's mysql db like this :
$db = mysql_connect("94.xxx.xxx.xxx:222", "user", "pass");
I got this error:
Warning: ...
4
votes
1answer
397 views
mysql change password in session
I changed my password from old hash to a new hash using the following query
SET SESSION old_passwords=FALSE;
SET PASSWORD = PASSWORD('[your password]');
I found this query on Mysql password hashing ...
3
votes
2answers
72 views
Understanding COUNT() as `count`,
I'm currently learning how to build a site in PHP mysql. However, I seem to fail to understand COUNT() as count and wouldn't mind some further explanation.
I get the principles of COUNT, 0 || 1, and ...
3
votes
1answer
105 views
What is the right way to manage users data?
I'm trying to create a simple register login script with user profiles, I created a table with the following structure:
+------------+---------------+------+-----+---------+----------------+
| Field ...
3
votes
2answers
334 views
Testing Query Speed
When I'm running a query for the first time, it takes x miliseconds to be executed. When I run it the second time it takes a lot less time. I assume that it is some caching involved in this mechanism, ...
3
votes
2answers
231 views
Which graph database for search engine and gis?
I just learned there are "graph databases" out there, which are more suited for two applications "search engine" and especially "gis".
To avoid discussions weather a relational DB is better suited ...
3
votes
3answers
179 views
Database design for changing number of fields
Google Contacts lets you to enter more than one phone number, or email address for a contact. You can add as many as you want. I don't know if there is a limit, other than practical list size. To ...
3
votes
1answer
1k views
Mongodb - Returning the points nearest to a location, with distance
What is the mongodb's equivalent to this query:
SELECT 111151.29341326*SQRT(pow(-6.186753-Latitude,2)+pow(106.772835-Longitude,2)*cos(-6.186753*0.017453292519943)*cos(Latitude*0.017453292519943)) as ...
3
votes
3answers
3k views
How to use insert delay with the InnoDB engine and use less connection for insert statements?
I'm working on an application which involves a lot of database writes, approximately ~70% inserts and 30% reads. This ratio would also include updates which I consider to be one read and one write. ...
3
votes
2answers
515 views
MySQL connection doesn't work anymore
I had two MySQL servers running (127.0.0.1:3306 and 127.0.0.1:3307). Now I get this strange error: mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet' I can ...
3
votes
3answers
125 views
Is there any way to temporarily enforce columnar uniqueness on items currently being inserted?
Is there any way to temporarily enforce columnar uniqueness on items currently being inserted? For instance, I'm splitting payments and charges to their own tables from a previously unified ...
3
votes
2answers
134 views
Selecting large data set on windows and linux
I need to parse a large data set, something like:
mysql_query("SELECT * FROM largeTable")
while($r = fetch()) {
//> Do something
}
I just need 1 row to be in memory at time, because I need to ...
3
votes
1answer
64 views
Get data from two tables with recursive relationships
I have a MySQL 5.1 DB, being used behind a PHP application to track permissions and other items that need to be issued to staff that hold various positions within an org. To track what privileges a ...
2
votes
2answers
114 views
SQL SELECT Kill FROM problem
$sql = "SELECT Kill FROM tbl_pvporderview";
Problem is that il lend up with : Incorrect syntax near the keyword 'Kill'.
Cuz kill is a TSQL command... any way to bypass it?
I cant change the column ...
2
votes
3answers
71 views
Implementing soft delete
Could someone please show or describe to me how to implement soft deletes?
I have table of vouchers with these fields: id, username, password, serial.
I want to display a given number of rows ...
2
votes
1answer
179 views
Parsing and binding variables for SELECT .. WHERE column IN ( .. ) queries
I'm looking to make sure that all queries in a php web application have proper use of bind variables to minimize parsing of the queries.
I'm wondering how Oracle parses queries that compares a ...
2
votes
1answer
299 views
how to retrieve rows of different dates using IN clause
My table structure:
+-----------------+--------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
...
2
votes
1answer
538 views
shopping cart database schema
I need help creating the schema for a database to hold information relative to a web user's shopping cart/session. Each session will have a session ID, a time stamp holding time of creation, an expiry ...
2
votes
1answer
635 views
How to speed up mysql query?
I have query :
SELECT
`school`.`ARCO_name`,
`student-`.`ClassSize_7`,
`student-`.`ClassSize_8`,
`degree_o`.`degree_code`,
`accredit`.`full_faculty_3`,
...
2
votes
3answers
588 views
Move Oracle data to and from MySQL with the help of PHP?
My application is in PHP which by default uses MySQL db. I have connected MySQL & Oracle dbs with PHP.
Now I want to move data from Oracle db into Mysql db through PHP. Is it possible to do? Is ...
2
votes
2answers
681 views
Preventing mysql deadlocks in your php application that uses SELECT… LOCK IN SHARE MODE
If I understand SELECT ... LOCK IN SHARE MODE correctly, you can place it into a mysql transaction to select the rows you will be working with during that transaction.
This is done in order to "lock ...
2
votes
1answer
225 views
Mysql - show results from 3 tables excluding NULL or EMPTY values for certain fields
I have 3 simple tables with polls, users and votes. I'd like to show all polls ordered by clean count of votes (sometimes either poll_id or user_id don't get inserted).
Furthermore I'd like to show ...
2
votes
1answer
490 views
Mongo connection failing with 'Transport endpoint is not connected'
I have a 2 server installation.
A web server with Apache and a DB server with MongoDB.
I am load testing it, and on ~300 RPS I am getting this error:
PHP Fatal error: Uncaught exception ...
1
vote
3answers
903 views
How can I copy data from one MySQL server to another based on a SELECT statement (then delete the data from the original)?
I have a very large log table from which I want to copy rows, putting them into the same table structure on a new server. I don't want to copy everything, only old rows, so that the table on the main ...
1
vote
1answer
52 views
Sanitizing a form's database input while retaining basic HTML markup
Is there a way to sanitize database input (say, for a comment form), which also allows for the end user to use basic HTML styling markup? As in, if a user wraps their text in <i>/<em> or ...
1
vote
1answer
33 views
Getting the data from a foreign key table
I have a table that relates a user to client using both their table id's
UsersClients Table
---------------------
| userid | clientid |
---------------------
| 2 | 32 |
| 3 ...
1
vote
2answers
199 views
mysql_select_db() very slow on a busy server
I have a MySQL Server with about 30 Databases and 1500 Tables. Overall size of the data is 2 GB. The Server has 16 GB RAM and an AMD FX-6100 CPU. Most tables are myisam.
On average the server answers ...
1
vote
1answer
383 views
“Mysql has gone away” heavy multiple insert
I am stuck because Mysql server will go away after executing this part of code this function will update the database with the new RSS feeds which are stored in ToUpdate but Mysql stops working. Every ...
1
vote
1answer
2k views
Connecting remote MySQL database to local MySQL database?
I want to write PHP code to be embedded in a Drupal7 module.
I want to call a procedure which can copy newly generated data in the local MySQL database to a remote MySQL database.
When data is ...
1
vote
1answer
108 views
Mysql database design with XML
I intend to create a wiki webpage, but it has some few more limitations than regular wikis. The content is completely user-editable, but the structure of the page is determined previously. To make ...
1
vote
1answer
1k views
Server requested authentication method unknown to the client [mysql_old_password]
Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password]
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the ...
1
vote
1answer
94 views
MySqli - select from db based on time difference with CURTIME() or SUBTIME()
I have a db with some customers data. There I store their last login time as datetime.
I want to run a cron php script every min which will query mysqli for their last login datetime and if that was ...
1
vote
2answers
77 views
Cannot INSERT into database on a shared server
I have launched an application on a shared server but I cannot INSERT any data. I thought maybe I don't have privileges so I did SHOW GRANTS in my application then die()
The result was [ EDITED ]:
...
1
vote
1answer
159 views
MySQL table locks solution -> InnoDb / Partitions
I'm experiencing many table locks in a MyISAM MySQL table that is pretty big (Constx10xGB and 15M rows).
It's mainly caused due many heavy inserts. My current thoughts to optimize:
Changing to ...
1
vote
1answer
181 views
How to get a unique highscore per user
I have the following tables: users, highscores
I would like to get the top ten best results in highscore. The scores should be unique, meaning one score per user. I tried using INNER JOIN and GROUP ...
1
vote
1answer
79 views
keeping database columns consistent with documentation
For a project, the client wanted to be able to add fields to any item and have them be searchable. To make them searchable, that would require the fields to take a column, but that would make the ...
1
vote
0answers
28 views
Repeated values in group_concat
I have two tables, first the table food and Second is Activity:
INSERT INTO food
(`id`, `foodName`)
VALUES
(1, 'food1'),
(2, 'food2'),
(3, 'food3'),
(4, 'food4'),
(5, ...
1
vote
1answer
64 views
Why does that query cause lock wait timeouts?
From time to time, I find a lot of these errors in my PHP error log:
MYSQL.1213: Deadlock found when trying to get lock; try restarting transactionSQL
The problem persists for about 2 or 3 minutes. ...
1
vote
0answers
51 views
mysql remote connect
Having troubles with this and I'm not sure why..
I'm trying to access a mysql database from another server.
I changed the my.cnf file (uncommented the bind-address to access from all):
port=3306
...
1
vote
3answers
161 views
MySQL large databases, unique index effect on efficiency?
I'm working on a table which holds around 300k records. I'm using a 3 columns unique index to prevent duplicate records. For some reason the database is taking long to insert new rows.
I have a few ...
1
vote
1answer
51 views
Group activities in activity feed by users and products
On my website I'm building an activity feed where I got the basics done and are now making some improvements here and there.
One of them is the grouping. I've built it so that if multiple users buys ...
1
vote
0answers
108 views
big mysql database optimization
My Joomla mysql database has about 3.4 million rows in content table. It is just static article. Very slow and often use out of resources. To speed up it, I segmented it into 6 sub-tables and added ...
1
vote
2answers
172 views
PHP-MYSQL messaging system performance problems
I want to create a messaging module for the social network web-site project (PHP & MySQL) I've been working on. What substructures do well-known sites use for modules like this?
I think, ...
1
vote
1answer
227 views
calculate the difference between two column aliases in a SELECT statement?
I'm not sure how to do the last part of my query, which is doing calculations directly with the aliases: (SUM(task_avg - minutes) AS difference. I don't think I can do it as easy as I'd like, but ...

