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

learn more… | top users | synonyms

0
votes
0answers
7 views

Connection to mysql database- alternating usernames

My server has a max_connections value of 400 and a max_user_connections of 250. Since I am always connecting with the same user name, my effective max_connections is 250 instead of 400. To solve this, ...
0
votes
0answers
9 views

change the name of the database according the changes in while loop [migrated]

<?php $sql="SELECT topics FROM subjects "; $result=mysqli_query($db,$sql); for($x=1;$x<=4;$x++) ...
0
votes
0answers
21 views

Searching on MYSQL database using LIKE having 1billion records [on hold]

I have a database public profile for university and the table grew in no time now i have more than 1 billion records and searching students records over these set of data takes over 50sec to 1.5 mins ...
0
votes
1answer
133 views

How to check mysql password change and other events logs

Recently someone change my phpmyadmin password and drop database I think it was sql injecting. Now I want to find information about this like when, how and who change my password Please tell me ...
0
votes
0answers
21 views

Post categories model for a user submission wedbsite

I'm building an user submission site where users can make posts to content_types: Blog, Movies, Photos, Forums. Since these content types only have slight variances I would like to keep them in one ...
0
votes
2answers
367 views

MongoDB/MySQL - auto increment vs object ID

I am in the process of evaluating MongoDB and writing some basic PHP applications around it. Typically in my PHP/MySQL applications, I would create an ID field and set it to auto-increment on each row ...
-2
votes
0answers
12 views

PMA-SQL-ERROR while importing databse in xampp [closed]

While importing database in xampp i am receiving following errors SQL query: <!-- PMA-SQL-ERROR --> <div class="error"><h1>Error</h1> <p><strong>SQL ...
0
votes
1answer
1k 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 ...
0
votes
2answers
161 views

MySQL - prevent OS cache for query

On high load production server I have many sql selects which are unique or re-use will be in hours. I use SQL_NO_CACHE but this queries are still cached with OS cache. Server have 64G ram and used ram ...
1
vote
3answers
15 views

Optimizing MySQL query with left joins

Ok, so first off i am going to provide a bit of information on the database structure I have 3 indexed tables that are used in this query (though one of them should probably be a weak entity, but ...
0
votes
0answers
33 views

Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)

I am using MySQL with PHP for printing details from a database. I tried to make a new user, which was successful, although I get an error from MySQL when I tried to fetch data from it. It showed me ...
0
votes
0answers
15 views

Searching a keyword from multiple tables using my querry , [migrated]

I want to search "law" from three tables tbl_books, tbl_books_author and tbl_books_subject. I am running following query. SELECT * FROM tbl_books p, tbl_books_author d, tbl_books_subject m WHERE ...
0
votes
1answer
253 views

Update table from calculated temporary table

I have two tables, one containing a set of user ID's, vote direction (-1 or 1) and ID of the object they voted on (casted votes table). In the other table, the object id, upvotes, downvotes and ...
0
votes
1answer
32 views

What is the most efficient way to exclude records with a particular ID in a MySQL query for random records?

I have an api endpoint that returns X amount of random posts from a table called "posts". This endpoint is used by a mobile app. It retreives random posts by doing a SELECT COUNT(*) on the posts table ...
7
votes
2answers
89k 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, each of which opens a MySQL connection. Now when I access PHPlist it often shows this error: Fatal ...
0
votes
0answers
16 views

I want to sync local mysql database and live server mysql database

My plan is to store data in my local MySQL database and after a time interval or when system connected to internet it will update my live MySQL database remotely Is it possible? I'm have a inventory ...
1
vote
3answers
36 views

Insert if NOT EXISTS not working

I am trying to copy data from table to another mysql table from two different databases First I get all data from first table and stored them into php variable then I loop on that var to insert data ...
0
votes
0answers
15 views

Formula/algorithm to merge and sort arrays into one [migrated]

I have four arrays that I need to merge/sort pragmatically. https://docs.google.com/spreadsheets/d/1e041YuQCUVu4_hgu1uCGaKILrL5a3WqReEeKtCeGLOs/edit?usp=sharing The link above shows the contents of ...
0
votes
1answer
217 views

Quickly establishing if a remote MySQL connection is valid using PHP

I have a hosted website (Namecheap Pro shared hosting) that connects to a remote MySQL database using a read-only user privilege. This remote DB is updated by a separate system. The website works ...
0
votes
0answers
25 views

php oracle 11g client side character encoding

My oracle 11g database has utf8 character encoding. And data like ä ö ü etc. Oracle is not on the same host as my php application. The database host can be a Windows 7 machine (in Windows-1252) and a ...
2
votes
1answer
520 views

Calculating the median value in a MySQL table with CodeIgniter

This is my model file in codeigniter. I need to calculate the median for this variable: budget_breakdown.breakdown_grants. How can I do this calculation? function reports_details1() { ...
1
vote
2answers
197 views

MYSQL joining 3 tables with left join

I have these tables: pupils: (id_pupil, name, surname, email, user, pass, level, class) incidents: (id_incidents, date, time, type_incident, comments, id_pupil, id_user, subject, id_trimester) ...
0
votes
2answers
42 views

Best configuration for MySQL? InnoDB and MyISAM

I read that InnoDB is supposed to be better at writing into MySQL than MyISAM, however, I'm trying it out, by running 3000 MySQL queries(Inserting rows, 8 Columns + id)... but results haven't turned ...
0
votes
1answer
149 views

Insert GEOMFROMTEXT (lat lng)

I am stuck, Please help. "INSERT INTO `routeplans` ( `polygon` ) VALUES ( GEOMFROMTEXT( 'POLYGON( (39.593254951279626 -119.2415714263916, 39.596231192849004 -119.2441463470459, ...
1
vote
1answer
114 views

Reviewing relational database tables

I am building a database, but I am a little bit confused with my table relationships. I wish someone could help review my table relationships below for me and tell me where I am going wrong. I have ...
1
vote
0answers
30 views

How to send MySQL query results to outfile and standard output at the same time?

I "normally" query MySQL with SELECT col1, col2 FROM tablename LIMIT 10; and sometimes instead send the output to a file with SELECT col1, col2 FROM tablename LIMIT 10 INTO OUTFILE ...
0
votes
1answer
139 views

MySQL taking significantly longer to query via PHP than CLI

TL;DR: I have a query that takes under a second to run via MySQL's CLI, but over 12 minutes via PHP and I'm at a total loss on what to check next. It's a fairly horrid query, full of joins, but the ...
0
votes
0answers
8 views

Single INSERT query for multiple records using Prepared statement [migrated]

Here's a fairly basic PHP PDO snippet that accesses a MySQL table named "Users" and inserts rows of data to it using a prepared statement and multiple bindings: $conn = new ...
0
votes
0answers
20 views

How to accept apostrophe in a form field for MySQL [migrated]

I have a form that accepts a few names and phone numbers and posts them to a PHP script which then inserts those values into a MySQL table. The code (PHP) is pretty straightforward as you can see ...
0
votes
2answers
259 views

MYSQL Master-Slave replication not working with PHP

My data gets replicated from the master database when I do it manually but when it gets inserted from PHP into the master database it doesn't get replicated to the slave database. My Master database ...
1
vote
2answers
118 views

SELECT and UPDATE in a single query while updating selective fields of duplicate records only

I have a MySQL table named Contacts_table with, say, the following contents: ID NUMBER NAME CITY 001 2222222222 John Doe Los Angeles 002 ...
1
vote
2answers
28 views

professional services (consultants) resource allocation system

I am developing a resource allocation system using PHP and mysql. I have consultants and projects and I need to allocate the consultants on to various projects for various periods of time on various ...
0
votes
1answer
44 views

How do I perform a query on a dynamic list of tables?

I have a database named as ( conntrack ) with unknown amount of tables.I have a static table "tabidx" which has one column "date". The following table is static and its name is tabidx which provide ...
0
votes
0answers
40 views

how can i connect from yahoo small business webhosting domain to remote mysql server

so far I have done these: set up remote access using Remote Mysql.Added the yahoo website's domain ip and yahoo nameservers. went on to my website on yahoo small business and set up an Aname and ...
0
votes
1answer
3k views

how to sync local mysql database and live server database?

My plan is to store data in my local MySQL database and after a time interval it will update my live MySQL database remotely. Is it possible? I'm planing a inventory management script in PHP MySQL. ...
0
votes
1answer
35 views

Storing small array of many possibilities

Let's say I need to store the text of a series of books, line per line in a database, and present them in a (CMS-based) website. I thought the correct setup would be: a 'library' table: containing ...
0
votes
1answer
11 views

How to store list data in our LMS?

I am looking at how we can store list information in our database. The example in question is regarding products. For every employee there will be a primary product and as many secondary products as ...
0
votes
1answer
28 views

Calculate total attendance for each workshop

I want to get overall attendance in each workshop. NumberOFWeeks column holds the number of weeks the workshop runs. for example Workshop 101 runs for 6 weeks meaning 6 days. So far I have done ...
0
votes
1answer
23 views

replace in String from subquery

I'm currently (trying) to optimize veery weird code. So please don't teach me about bad DB design ;-). Assuming there are two tables messages and options In the messages table theres a string like ...
-2
votes
3answers
59 views

How to interract with my database? [closed]

I am generally new to Databases, and I have a MySQL server with several tables which have a unique ID that is connecting them all. I am about to populate the db with data from external resources ...
0
votes
1answer
38 views

combining two different record into single result

I am fetching data from 3 tables with the help of join. My output is in JSON format. Output in JSON format:- {"order_id":"2", "location_address":"Testing location Delhi", ...
0
votes
0answers
38 views

difference between phpmyadmin and php PDO

I'm running a query in Phpmyadmin and also execute the same query with php PDO but results are not equal. What could be wrong ? This is query : SELECT dim_date_key as date ,dim_jdate_key as jdate, ...
0
votes
0answers
51 views

How should I store image, text type files in mysql?

I came across some answers mentioning the "disasters" of storing files outside database and saving the path inside database. I've also noticed dozens of answers about storing images- which suggest to ...
0
votes
0answers
17 views

Hostgator php code error while creating a new database table

Error is Error creating database: Access denied for user ''@'localhost' to database 'my_db' Code is { <?php $link=mysql_connect ("localhost", "cpuser_dbuser", "password") or die ('I cannot ...
1
vote
1answer
714 views

Transpose MySQL rows as column names - DYNAMIC

My goal is to be able to calculate the time difference between the ticket timestamp being created and closed and if reopened Add time from being reopened to closed again etc.. I have an existing mySQL ...
0
votes
0answers
30 views

Get disk usage information of mongodb database

I have a database built in MongoDB and I need to obtain information related to the disk usage of the database through PHP. I have searched a lot but did not find relevant search results for retrieving ...
0
votes
0answers
17 views

How to create relations in database

I have two table: users and projects. In projects admin can add projects like: web design, SEO , etc.... I need to add abilty to admin can add some users to certain project... For example I need ...
0
votes
0answers
32 views

How to group two query that have already been grouped

I am creating a chat system and i have two queries: The first query selects the Max(id) meaning the last message that has been received or sent by the member that is connected and that has not yet ...
1
vote
1answer
83 views

Select with limit, get total count, optimize query [closed]

The site mimics the "likes" tooltip from Facebook, the only difference is that you can like or dislike the content. The tooltip shows the first 12 users that rated the content and displays the number ...
0
votes
0answers
42 views

Multiple values as single array in Query

Query: SELECT a.*, b.a_val as definition_value, c.a_id as definition_name FROM products a INNER JOIN attr_vals b ON a.sku = b.sku INNER JOIN attr_defs c ON b.a_id = c.a_id ...