Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [php]

Use ONLY if PHP is directly relevant to the question and likely to be the source of your problem, not just because you're using a PHP library to connect to a database. PHP stands for Professional Hypertext Preprocessor, a widely used platform for dynamic web applications. If you have a general programming question about PHP, please ask it on Stack Overflow instead.

-3
votes
0answers
19 views

Please get me started [on hold]

I am a teacher and am looking to add worksheets to the school website whereby the student can fill in a text box and the web page will tell them if they have the answer correct instantly. Then at the ...
0
votes
0answers
19 views

PHP-FPM Can't connect to Mysql via localhost but can by ip

Using mariadb 10.2, php 7.0, in Centos 6.9 hosted cpanel server. Everything is installed and compiled through cpanel. If I put PHP into FPM mode it cannot connect to DB unless I specify 127.0.0.1 ...
0
votes
0answers
19 views

Improving/ Optimizing Performance Query in MySQL PHP

I have a invoices, invoices_items, order, order_items. Invoices and Orders tables contains around 1 Millions records. Invoices_items and Orders_items tables contains more than 2 Millions records. ...
1
vote
0answers
24 views

Weird MySQL column name issue

After trying to use the Propel PHP ORM on my database, I noticed that there is an issue with foreign keys. This is a table with foreign keys: CREATE TABLE `appusers` ( `AppID` INT(11) NOT NULL, `...
0
votes
0answers
10 views

How to get single row data into a row with multiple columns [duplicate]

I have a table as follows: Id Movie_name Person_Name Role_Name 1 mov1 xyz Singer 1 mov1 pqr Dancer 1 mov1 abc Actor 2 ...
0
votes
1answer
17 views

Accessing mysql database without logging in (from android java application) (using php server side) [closed]

Just like all e-commerce applications (like amazon) let you access the database and browse items without logging in or signing up, how can i do this with mysql database (without logging in with ...
0
votes
0answers
18 views

PHP - mysqli::real_connect(): (HY000/2002): Invalid argument in file

On a work project, I'm load-testing a php service on MySQL 5.6 loaded on a beefy Google Compute Engine VM. After I exceed a certain amount of requests per second in my load test, MySQL starts giving ...
2
votes
0answers
31 views

SQL Server stored procedure not throwing certain kind of error

I noticed an issue in my app recently where an database insert that occurred in a stored procedure was failing, but no exception was getting thrown. The insert failed because a column that doesn't ...
0
votes
2answers
58 views

Most performant design for each member to manage his/her own news list?

Say a news website has news categories such as Politics, Business, Society, Education, Health, Tech, Celebrity, Lifestyle, ... etc. The number of categories may be more than 20. New categories may be ...
0
votes
1answer
31 views

Get total row by month in multiple tables [closed]

I am new in Oracle database and php, I tried to create a monthly report which covers the whole 12 months of a year. Currently I have 5 different tables which will store data every month for one year. ...
0
votes
1answer
23 views

Using a DB2 merge with conditionals for matches?

Within a PHP script I'm running a working merge but I need to add date conditionals to it, and my updates cause it to no longer work. The logic I'm looking for is this: If there's a match AND the ...
0
votes
0answers
26 views

Display Dynamic Pivot MySql Table to PHP

i need help on how to display this on html or php. i have this dynamic pivot table code. SET @sql_dynamic:= (SELECT GROUP_CONCAT(DISTINCT CONCAT('if(sum(if(attendance_date = "', ...
0
votes
0answers
4 views

Submit values to mysql data base form a form in side another form together

I have some questions on php. imagine this form <form> <input type="text" name="name"> <form id="second" onsubmit="return false;"> <input type="text" name="name1"> </form&...
0
votes
0answers
29 views

Connecting to MS SQL Server database via PHP

I’m new to SQL, databases and PHP, and I’m trying to find out the way to query my MS SQL Server database via PHP. I understand I must first establish a connection to the database which is accomplished ...
0
votes
0answers
24 views

Need an efficient mysql database schema to store points/ratings

I have four main tables- 1.user(user_id, name,...) 2. post(post_id, description, ...) 3.comment(comment_id,user_id,comment,...) 4.reply(reply_id,user_id, reply,...) and 5.user_post(user_id,...
0
votes
3answers
16 views

MYSQL: Display NULL value when foreing key is NULL

I have the following database structure in MYSQL: CREATE TABLE xs_bugtracking ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `product` VARCHAR(64) NOT ...
0
votes
1answer
43 views

Help in mysql query

I have a column in database with name paid_amount that have multiple values with a separator like: 1,2,4,10 I need the sum of these values: sum = 17 select sum(paid_amount) from invoices where ...
0
votes
1answer
116 views

Postgresql 10 There is no unique or exclusion constraint matching the ON CONFLICT specification

I currently have a table which looks like this: CREATE TABLE "PDPC".collection ( col_no bigint NOT NULL DEFAULT nextval('"PDPC".collection_col_no_seq'::regclass), q1 character varying(10000) ...
0
votes
1answer
50 views

MYSQL ONLY RIGHT JOIN WHEN LEFT SIDE NULL

my English is not that good, so translated with Google Translate. Have been able to fix many problems with this site anyway, thanks to all active users here. Unfortunately I have to ask my first ...
0
votes
0answers
28 views

SQLITE PHP Like Query wont return results on all rows

I have created a SQLite query in PHP which queries user input and checks it against the database, however when I run the query it just displays everything in the database. and if I was trying to ...
1
vote
1answer
46 views

Prepared statement too slow

have an issue with MariaDB 10.2.12 running in aws rds (single master, no slave) when I run prepared statement using a variable substitution PREPARE stmt1 FROM "select ...quite complex select from ...
0
votes
2answers
47 views

UPDATE with multiple WHERE and SELECT condition - MySql

So, I have two tables ativos and colaboradores and they are linked by id_colaborador (FK) on my update page, I'm able to change the id_colaborador but instead of changing the ID I want to write the ...
1
vote
1answer
42 views

Is it possible to output multidimensional data from linear table without iteration?

I have the following table on a cycling club's website: CREATE TABLE `mileage` ( `id` int(11) NOT NULL AUTO_INCREMENT, `rideID` mediumint(9) NOT NULL, `rideDate` date NOT NULL, `isWeekly` tinyint(...
0
votes
1answer
21 views

Why is this blob saving when used as a concatenated string but not as a prepared statement

I have a PHP mysqli prepared statement that looks like this: $editSQL = "UPDATE tblClientReminders SET Header = ?, Notes = ?, DepartmentID = ?, TierID = ?, RemindType =...
2
votes
2answers
246 views

How do I use 'N' in my prepared SELECT statement

I'm connecting to an SQL Server 2008 database using pdo and the ODBC Driver 13 for SQL Server. I'm trying to run the following query which searches the database for Chinese characters: SELECT TOP (...
1
vote
0answers
40 views

MySQL count rows of multiple tables for each user

I basically need this with some adjustments, I just can't seem to figure it out how to do it. I need to sum the rows of two tables, for example: SELECT student.StudentID, student.`Name`, COUNT(...
8
votes
2answers
219 views

How to create recurrent weekdays as columns in a pivot?

I am newcomer to programming and databases and I would be grateful for some help on the following scenario. I use PHP with SQL Server. I am building an employee attendance system and I would like to ...
0
votes
2answers
29 views

How can I select the next available row id of varchar type in MySQL?

I have a table with primary key 'Id' of varchar type. I want to select the next row when user clicks next record, in php, for example 1st row id= 'a' 2nd row id= 'b' 3rd row id='h' 4th row id='z' ...
-1
votes
2answers
49 views

MySQL Query can we count rows using php to reduce time of count(*) in a query or there is no difference?

Having the following queries, where the first query is returning a field of number of rows found, and the second returns the actual rows: First Query: SELECT count(*) as total FROM individual i ...
0
votes
1answer
25 views

Update two tables, each on separate MySQL servers, on two different machines in one query?

Have two MySQL servers running on two different machines in a local network. Using PHP and accessing via IP. No problems there. The databases have identical schemas. One was an import from the other ...
0
votes
2answers
29 views

Joining mysql tables

I am trying to join tables for a search form, and when I do the search exports the result x3 the output could you guys give me a hand please? $raw_results = mysqli_query($db,"SELECT * FROM ...
0
votes
2answers
54 views

Update from PHP 5 to PHP 7.0 - PHPmyAdmin will show two server logins: localhost / localhost:3306

I updated my Linux 14.04 LTS to 18.04 and had to downgrade the PHP 7.2 to 7.0 as I need to run some software which is not capable of the preinstalled PHP 7.2. I used PHP 5 so far. After I got ...
0
votes
2answers
27 views

Check if column UPDATE occurred

When we update a MySQL record with php, we can check if it has effect using: $mysqli->affected_rows; But how do I check which column has been modified? Example, in my table have the columns: id /...
0
votes
2answers
39 views

How to select datas for a particular user between a date range

I am querying a table with where condition in which i want to choose between a particular date range at present my query is like this with a where condition. WHERE entered_by = '1' AND date_created = ...
0
votes
1answer
624 views

In PHP MySQL how to sum or not sum multiple columns?

I have three tables this is my codes: <table border='1'> <tr> <th>Subject</th> <th>Mark1</th> <th>Mark2</th> &...
0
votes
1answer
79 views

Query Error: Error: ER_NON_UNIQ_ERROR: Column 'candidate_id' in field list is ambiguous

This is my query SELECT user_name,candidate_id FROM user AS usr INNER JOIN candidate as can ON usr.user_id = can.entered_by INNER JOIN candidate_joborder as canjo ON can.candidate_id = canjo....
0
votes
2answers
57 views

phpmyadmin/ mysql how to copy a table with all its constraints

I tried to copy a table which is connected to another table through a foreign key using $query = "CREATE TABLE table1 AS SELECT * FROM table 2"; but when I run this query it copies every thing but ...
0
votes
1answer
51 views

How to write a query for picking 20 items from six tables with two conditions

I have six tables. candidate,candidate_joborder,company,extra_field,joborder,user I want to pick up 20 items from these tables with query those items are as follows. name from company table. title,...
0
votes
1answer
27 views

Converting colums as row

My mysql data is like this CREATE TABLE `extra_field` ( `extra_field_id` int(11) NOT NULL, `data_item_id` int(11) DEFAULT '0', `field_name` varchar(255) DEFAULT NULL, `value` text, `...
1
vote
3answers
42 views

Quering date from date and time field

I have a table which is like this. CREATE TABLE `candidate` ( `candidate_id` int(11) NOT NULL, `site_id` int(11) NOT NULL DEFAULT '0', `last_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL ...
2
votes
1answer
81 views

How to select multiple item from database

Please help me. How to select student result from databese using multiple select. But not work....... My Student Database like - std_profile id StudentId stdName stdRoll stdClass 1 ...
1
vote
1answer
21 views

extract different number of rows from multiple tables

I have a quick question. I'm looking for the concept behind this, not necessarily a ready-to-use code, but if it's not too complex, I don't mind a quick solution. I have an app that manages accounts. ...
1
vote
1answer
465 views

Missing mysqld.sock file on linux server

I have this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") Anyone know what is wrong? It seems it isn't ...
1
vote
1answer
133 views

How to open a file in MySQL event scheduler?

I am currently creating my first event in MySQL: CREATE EVENT check_for_uploads ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE ON COMPLETION PRESERVE DO // I would like to open a .php file ...
0
votes
2answers
154 views

Parameterized Queries in PostgreSQL using PHP fail to handle null values

I'm using PHP and PostgreSQL on OpenBSD 6.1, with pg_prepare and pg_execute to effect parameterized queries. $rs = pg_prepare($con, base64_encode($query), $query); $rs = pg_execute($con, ...
1
vote
0answers
41 views

What is the proper way of designing database with dynamic fields in MySQL + PHP?

I need help on designing a proper structure for a database table with dynamic fields. I am using MySql with PHP and the system I'm currently working on (inventory system) requires a table that accepts ...
1
vote
1answer
48 views

How to log or see all MySQL errors? [closed]

I have a website, which collects input from the user. When his data cannot be inserted into a database, I simply display "Sorry..." I am hosting my website on LAMP. I am new to MySQL and would like to ...
1
vote
2answers
374 views

MySQL Query Failed: Expression #6 of SELECT list is not in GROUP BY clause and contains non aggregated column fixed bug reappear every restart

MySQL Query Failed: Expression #6 of SELECT list is not in GROUP BY clause and contains nonaggregated column This bug is fixed using below query. by logging into MySQL console as root user SET ...
-1
votes
1answer
44 views

join 2 table and the value in a specific manner

I have 2 table one is master and another one is the child, now I want to write a query in such a way that all the value from the master should display and the count of that particular parent id row ...
0
votes
0answers
476 views

how to calculate attendance percentage for every month in sql, php

$day = query("SELECT monthname(date) as Mnth FROM attendance WHERE teacher_id=7 group by Mnth"); foreach ($day as $value) { } I want to calculate the percentage of present from every month..thnks