Tagged Questions

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

learn more… | top users | synonyms

0
votes
2answers
1k views

Difference between two recordsets

I'm looking to calculate the difference between two record sets in MySQL. Say I have the following table: colname type attrbutes id uInt PK date date PK count uInt With this data: id ...
1
vote
1answer
86 views

Recover Wrong encoded string values in MySQL database

I have a database in which I store the alt and title values of the images. Unfortunately the program which inserts these values hasn't been connecting to the MySQL database with a UTF-8 link and the ...
1
vote
2answers
373 views

How to calculate total ON hours and Total OFF hours in day of a motor using PHP and MySQL [closed]

In my application I would need to calculate total ON hrs and OFF hrs in a day of motors in one tank. Every time he/she turn ON/OFF motors, data will go and store in motor_status_log table of my ...
1
vote
2answers
2k views

MYSQL matching one column to another in a different table via a FULLTEXT index

I current have two different tables. The first table has a list of titles and IDs associated to these titles, the second table is a list of random heading. What I would like to know is if there is a ...
1
vote
3answers
648 views

Why are there different levels of MySQL collation/charsets?

Looking at the MySQL server variables the server and database collation are set to latin1_swedish_ci but the collaction_connection is utf8_general_ci. Additionally, the collation/charset is set at ...
1
vote
2answers
720 views

Which is better: more rows or more columns in a student attendance table?

I want to create an attendance table for student attendance. Which structure should I go for? I have two options. attendance(student_id,date,is_absent,reason) ...
4
votes
5answers
1k views

Fast way of delete MySQL record

I have a 1.2 million record in a database table( it use index column also) I want to delete old 1 million record. I try to do it using PhpMyadmin but it take more time. DELETE FROM `table` WHERE ...
-2
votes
0answers
50 views

MySQL-CLuster PHP5 [closed]

I have installed correctly MySQL Cluster on my Vm's the mgm nod with two SQL/Data node and everything looks ok, but I cant run my application because MySQL Cluster dont see PHP5 anyone know how to ...
0
votes
0answers
80 views

Automated query log

I would like to ask for some opinions or recommendations or guidelines on how to create an automatic logging system for the executed querys on a MySQL database. Some details: its a php+mysql ...
-1
votes
3answers
721 views

App can't find or connect to database

I'm trying to install a web app on my Ubuntu 12.04 server. The app is based on PHP and MySQL and I've got LAMP already working OK on my server - infact I've already got other apps working on PHP & ...
0
votes
1answer
628 views

User roles and permissions

Look at the attached graphic. I'm trying to keep this as simple as possible. Basically I want to have multiple admins(or superusers) who own regular users who own sites. Admins can give regular ...
0
votes
0answers
148 views

Query should yield result but doesn't

I need to get data from a remote SQL 2000 server and store it in a new MySQL server. I am using the FreeTSD module for php 5.3 to connect to the SQL 2000 server. I can connect without problems. ...
1
vote
1answer
2k views

How to run a SELECT query within while loop in PHP?

Within a SELECT query via PHP while loop, I need to run a mysql SELECT query as $result1 = $mysqli->query("SELECT * FROM table1"); while ( $row = $result->fetch_assoc() ) { if ( $row['X'] == ...
1
vote
3answers
196 views

database structure - complicated requirements

I have a project to build a website but it's complicated and I'm having trouble figuring out what the best way to build the database would be to handle these particular requirements. The site is for ...
0
votes
1answer
561 views

The UPDATE permission was denied on the object

I'm connecting to a remove Microsoft server running MsSQL via PHP. The code looks something like: $con = mssql_connect('0.0.0.0:123', 'user', 'pass') or die(log_mssql_error(__FILE__, __LINE__, ...
-2
votes
1answer
103 views

how to count primary key of one table inanother table? [closed]

how to count primary key of one table which is used in another table in 5 to 6 column? If table 1 has primary key srno which is used in table2 in column d1,d2,d3,d4. I want to count how many times ...
0
votes
0answers
325 views

Mysql 5.6 and install php5-mysql , mysql-common

I install Mysql 5.6 with this documentaion(in ubuntu 13.04) , now I need to install php5-mysql and mysql-common packages. can I install them with apt-get? I think they will install mysql5.5 ...
0
votes
1answer
477 views

Simple MySQL table copy from one server to another?

this question has kindof been answered in a number of ways. Nothing that quite fits the bill (as far as I understand it). I have MySQL Table X on Server A. I would like an exact copy of this table, ...
0
votes
1answer
72 views

Search speed increase

I've heard that some queries like DELETE, or changing the structure of a table can decrease the speed of the search in a table. First: is this true , or not? Second: is there any way to increase ...
0
votes
1answer
86 views

Am I overengineering MySQL?

On my project, I have to make difference between registered users, and simple visitors. Both of them can set their own properites, specified in accounts and visitors table. I identify them by cookie, ...
0
votes
0answers
448 views

MySQL is running but not working [closed]

In an attempt to tune MySQL to make it work with a recent installation of Drupal I had to modify the MySQL settings on my server. After modifying the configuration file for MySQL (/etc/my.cnf) MySQL ...
0
votes
2answers
7k views

Insert data in current table and update another table MySQL

I'm having problem with inserting in purchase table and updating facility table. Let's say, user made a purchase with product_id and product_quantity. When user hit submit, I want to insert ...
0
votes
1answer
353 views

Different Result When Insert Data Contain Quote on Localhost and Online MySQL Hosting

I installed xampp on localhost and insert data contain quote using this php code $content = htmlentities($_POST['content']); $content_esc = mysql_real_escape_string($content); $save = ...
2
votes
2answers
169 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, ...
3
votes
1answer
538 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 ...
1
vote
1answer
737 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 ...
0
votes
1answer
175 views

Memcache implementation

I have a Wordpress site that uses WP Super Cache plugin in order to make my blog posts and pages stay as HTML so that less PHP/MySQL code is executed. However, there's a featured box that can't get ...
0
votes
1answer
954 views

MySQL PDO Cannot assign requested address

Can someone help me with this error? [08-Apr-2013 17:44:08 Europe/Berlin] PHP Warning: PDO::__construct(): [2002] Cannot assign requested address (trying to connect via tcp://****:3306) in ...
1
vote
1answer
502 views

good practices of creating tables in mysql [closed]

Hi I was thinking of developing an web apllication using php and mysql. Application will give a professor the required data about the student. i want to design application considering Engineering ...
0
votes
1answer
345 views

Zip based search in mysql.

I want to implement a zip based search in mysql database, I am populating the location column in my database based on a drop-down where in I have predefined zip codes, now if a user wants to search ...
0
votes
0answers
97 views

Database Schema/Structure advice

Well i am reconstructing an already created application and was looking to improve this, especially with in the database structure. I want to start off with probably the biggest section and that is ...
0
votes
1answer
154 views

how to use mysql to delete only the first ten table records?

I'm currently using php and mysql together. What I want to try is if I have ten "stable" records for the database and in the same .php file I have some text boxes so I can type in then what I typed ...
0
votes
1answer
303 views

Mysql - Problem speed of access on query (Low latency query sometime)

My web application is real time site that need a speed of access on every query (SELECT, UPDATE, INSERT) that must less than 200ms Because one of my php script task is query (SELECT, UPDATE, INSERT) ...
0
votes
1answer
177 views

Large queries on MyISAM tables crashing MySQL

I have a PHP website, which is using the third-party software ResourceSpace, that when I installed it, it used my default storage engine to create the tables, which at the time was MyISAM. Now that ...
3
votes
1answer
3k 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. ...
3
votes
2answers
772 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 ...
4
votes
1answer
2k 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: ...
0
votes
1answer
320 views

Making a message system

I have created a messaging system with MySQL structure is as follows `message_id` int(11) NOT NULL AUTO_INCREMENT, `message_from` int(11) NOT NULL, `message_to` int(11) NOT NULL, ...
0
votes
1answer
75 views

Setting up a use voting table

I had a table to store user votes for other users. So user1 can vote for user2 (vote up or vote down). One user should be able to vote for many users, but not repeatedly to the same user; user1 can ...
0
votes
1answer
2k views

Problem with (not) Locking Tables during Restore

First time here in DBA. I'm working to create a simple and strong database backup plan. My solution that is already working to create a gzipped, encrypted backup is: $string = "mysqldump -u$db_user ...
0
votes
1answer
49 views

Using multiple server databases

I was just seeking some higher advice on whether or not having your main data on one database, then having separate server database to use for frequent updating and reading will prove to be an ...
1
vote
0answers
689 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 ...
0
votes
1answer
257 views

PHP and mySQL - Binding a parameter in an if statement

Setup: I have 4 tables: guestList eventList inviteList rsvpList The descriptions of the tables: guestList +-----------+-------------+------+-----+---------+----------------+ | Field | Type ...
0
votes
0answers
350 views

MySQL Left Join Select all rows

Hi guys I have a query which is pulling data from database : SELECT sandwich_table.id, `sandwich_name`, salad, COUNT(salad), salad_type.type, ...
0
votes
0answers
223 views

Try to find a match using SUBSTRING(SHA1(value)), 0, 6)

I have a tbl where all entries for companies that participate in a online project are saved. This table is named "business". Those companies can use their employess to access the online platform i 've ...
2
votes
2answers
9k 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
3answers
5k 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 ...
2
votes
1answer
998 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
415 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 ...