Professional Hypertext Preprocessor, a widely used platform for dynamic web applications.

learn more… | top users | synonyms

2
votes
1answer
1k 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 ...
1
vote
1answer
5k views

Connect Error (2054) - mysql_old_password issue still not solved

i use php 5.4.3 and i want to connect to a MySQL DB remotely (php script resides on a different server than the db) with normal oop way: $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); ...
1
vote
1answer
429 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
3answers
439 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 ...
0
votes
1answer
204 views

MySQL collate error occurs when sent by PHP app but does not occur in phpMyAdmin

I have a query that uses: t3.`value` LIKE "%someval%" COLLATE utf8_general_ci I load the page in my browser and get this error printed to the screen: COLLATION 'utf8_general_ci' is not valid for ...
2
votes
1answer
370 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 ...
1
vote
1answer
223 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
2answers
371 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 ...
3
votes
1answer
218 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 ...
1
vote
0answers
264 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 ...
9
votes
1answer
493 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 ...
0
votes
1answer
1k views

Importing CSV file to MySQL via PHPMyAdmin

I am currently stuck and unable to upload a complete CSV file into a MySQL database. Unfortunately, the nice folks at Stackoverflow haven't been able to help me solve this issue, so I'm hoping someone ...
1
vote
2answers
107 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 ]: ...
3
votes
1answer
4k views

how to retrieve rows of different dates using IN clause

My table structure: +-----------------+--------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | ...
0
votes
1answer
575 views

Too many records on database and how to handle it? MySQL is it good to clone?

I am doing a social network and came up with the following concern regarding database storage. Let's put facebook as an example, imagine 2,000 photos per user, just 1,000 users, it would equal to ...
4
votes
2answers
164 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 ...
-1
votes
2answers
229 views

How to update an SQL column using a known perm link while appending a value from another column within the same table? [closed]

Larger view of the issue is here: http://i1268.photobucket.com/albums/jj572/LinuxOwner/question.png
1
vote
3answers
2k views

Deleting Data From Multiple Tables

Suppose,I've a table called UNIVERSITY containing universities name: universityID universityNAME isACTIVE 7 GNDU 1 6 PU 1 5 ...
1
vote
2answers
265 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
63 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 ...
5
votes
3answers
1k 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 ...
1
vote
1answer
720 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 ...
2
votes
1answer
929 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 ...
0
votes
1answer
58 views

Searching through lots of applications

Google search has instant search feature. While you are typing, it finds the pages. Apple.com search box. StackExchange ask question part finds similar questions while you are typing question title. ...
0
votes
1answer
98 views

Is Index Used for This Query

If so, which one? How do we know? I have 3 indexes in a query. Actually only the first 2 should be useful { "v": NumberInt(1), "key": { "LongitudeLatitude": "2d", "Prominent"▼: ...
0
votes
1answer
835 views

database creation using codeigniter database dbforge class gives “Access denied for user 'username'@'localhost' to database 'database_name' ”

Using codeigniter database dbforge class I have created a database and loaded that database as the current database and created tables in localhost WAMP server. But when I uploaded it to the server I ...
3
votes
1answer
877 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 ...
3
votes
3answers
290 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 ...
0
votes
1answer
798 views

WorkAround for PHP PDO(with libpq V 9.1.4) binding for use of CITEXT?

The scenario Two systems(not server) running PHP and PostgreSQL with the following versions Fedora 15: PHP PHP 5.3.13 (cli) (built: May 9 2012 14:38:35) Copyright (c) 1997-2012 The ...
1
vote
1answer
321 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 ...
4
votes
2answers
449 views

Escaping T-SQL Keywords

$sql = "SELECT Kill FROM tbl_pvporderview"; Problem is that I end up with: Incorrect syntax near the keyword 'Kill'. Because kill is a T-SQL command... any way to bypass it? I can't change the ...
0
votes
0answers
755 views

Sqlsrv sqlsrv_num_rows FALSE, adding cursor type times out

$sql = "SELECT * FROM lastdeath"; $result = sqlsrv_query( $con, $sql); if( $result === false ) { die( print_r( sqlsrv_errors(), true)); } $row_count = sqlsrv_num_rows($result); echo $row_count; ...
3
votes
3answers
511 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 ...
1
vote
0answers
272 views

MySQL GROUP BY and ORDER BY giving inconsistent results

I'm currently working with WordPress, and I've added a new meta value which is a number between 0 and 30. Zero is ignored and up to 30 need to be organised in order and only the latest (based on the ...
1
vote
1answer
749 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 ...
5
votes
2answers
69k 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 ...
1
vote
1answer
4k 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 ...
2
votes
1answer
918 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`, ...
1
vote
0answers
941 views

SQL query optimization in Prestashop e-Commerce solution

I'm working on a layered navigation module within Prestashop e-Commerce solution. I'm trying to optimize a SQL query which creates a temp table during execution. I think this is creating a ...
4
votes
3answers
10k 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. ...
1
vote
2answers
6k views

Script to show mysql health status?

Kev suggested this question ( http://stackoverflow.com/questions/10524981/php-script-to-show-mysql-health-status ) is better fitted here. I know phpMyAdmin can shows the lists of mysql vars and ...
4
votes
1answer
944 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
149 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 ...
1
vote
1answer
424 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 ...
2
votes
3answers
887 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 ...
1
vote
1answer
139 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
95 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 ...
0
votes
1answer
197 views

What would be the best way to design a table in Mysql that handles read items in an RSS feed reader?

I'm working on an RSS feed reader, it is mostly functionnal. But after some time beta testing it, I noticed that its very slow running some queries on a table that handles all the items that have been ...
0
votes
1answer
1k views

I want to count all the rows for todays / yesterdays date based on a DATETIME - mysql+php

I have database "db2" with table "menjava" In table menjava have "id", "author" and "date_submitted" field id - auto_increment author - int(11) date_submitted - datetime I want to count all the ...
6
votes
7answers
40k 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 ...