Stack Exchange Network

Stack Exchange network consists of 174 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 ...

-1
votes
0answers
14 views

Making a button disappear after clicked in php [migrated]

my current code is this button type="submit" class="btn btn-primary btn-lg" name="submitbutton" value="Submit" onclick="this.style.display='none';"> Execute Procedure </button I am trying ...
-1
votes
0answers
16 views

Help needed in PHP MySQL code [on hold]

My Code is not working like this <?php require_once('DbCon.php'); // Connect to DB if(isTheseParametersAvailable(array('a', 'b', 'c', 'd','e'))) { $a = $_POST['a']; $b = $_POST['b']; $c = $...
0
votes
1answer
28 views

Get Table name from another table [on hold]

SELECT column1, column2, column3 FROM ( SELECT State FROM (SELECT Country FROM t1 where ...) where ... ) where ... MySQL query Is not working in PHP. I ...
-1
votes
0answers
14 views

Connect to db by session PHP [closed]

i am trying to make multi language website in php and mysql and i have sessions for EN and FR and i want if session is EN to connect to db2 which i have all texts in english and for FR the same thing, ...
0
votes
0answers
19 views

Activity log PHP webapp MySQL [on hold]

so I have 3 tables on my DB users colaboradores and ativos (quick explanation: users are the permission levels like 'admin' and 'normal user', ativos are just items that are given to colaboradores ...
0
votes
2answers
29 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
40 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
0answers
17 views

Mysql restore to updated rows

I’m creating an web application, where registered users can create and edit products. Everything works perfectly, but ať this moment I’m thinking about two situations: User123 makes a miss click and ...
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
219 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
19 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
201 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
0answers
30 views

Create dynamic mysql queries in php safely

I am building a system which is dynamically expandable, new tables are dynamically created in the system based on end user actions, due to this there is no way for me to be able to 'code in' all ...
0
votes
2answers
26 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
vote
0answers
32 views

Complex query help needed

Dear Stackexchange members, My problem I need help with the following in MYSQL: For a website that rents accommodations I need to calculate the availability of the rooms. A scenario: A user wants ...
-1
votes
2answers
45 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
0answers
43 views

How to make below mysql query fast?

I have three tables one is question table(user_questions) and the other one is answer table(user_answers) and the third one is votes(user_question_votes) against questions I want to show users how ...
0
votes
1answer
21 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
27 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
39 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
26 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
35 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
302 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
42 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
32 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
24 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
40 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
70 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
19 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
266 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
85 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
0answers
28 views

VB.net insert to Remote MySql Server on a Network with a Proxy Server

The network at work has a proxy server which doesn't allow my desktop application to communicate to a remote mysql server; the Proxy Server doesn't allow communication to the remote MySql server's IP. ...
0
votes
2answers
105 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
36 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
40 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
344 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
30 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 ...
1
vote
1answer
36 views

How can I get the people I follow but they don't follow me? [closed]

I have a table called follows_syds. It has two columns follower and following. My query is SELECT * from follows_syds t1, follows_syds t2 where t1.follower = ? AND t1.following != ? ...
0
votes
0answers
371 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
1
vote
1answer
54 views

Calculate new percentage when new record is added

I have this MySQL that I am using to calculate a percentage for a segment in a call. When a new record is added, I am able to get the correct percentage for each row. $sumGreeting = $dbcon->...
0
votes
1answer
301 views

How to execute dependent multiple SQL queries from multiple databases via same PHP web page?

We can connect a single PHP page with more than one databases. But what about executing multiple dependent queries that belong to different databases? mysqli_multi_query(connection,query); does not ...
3
votes
0answers
36 views

Is it a good idea to create a new table for every new user or just having one table to store all the chat messages? [closed]

I am creating a chat system of my own and I have implemented the data structure as there is a table(with unique id of the user) added to 'Chats' database at the time of creation of his/her account. So ...
0
votes
0answers
104 views

Trying to update timestamp using FROM_UNIXTIME

I am trying to use an UPDATE statement using PDO with bindValue in PHP unsuccessfully. Basically I want to manually set the timestamp value but nothing I have tried seems to work. If I just update ...
-1
votes
1answer
46 views

sql statement to alter table using where condition

After successful payment, i need to update the database. there is a column named access which is blank by default. when the payment is succesful the column should be inserted with a value called "...
1
vote
1answer
555 views

PHP MYSQL Update Two Tables Using Cross Joins

I am running into a problem updating my two tables at the same time. My first table res which needs to be updated every time the other table rest gets input from a HTML Form. Table res=> http://...
0
votes
1answer
106 views

Extremely slow website, MySQLTuner log, any advice?

We are running a Wordpress site and are having major problems with extremely slow response time for pages that have to miss the Nginx cache. I'm looking at our database performance as a culprit, and ...
2
votes
1answer
568 views

Why is ON DUPLICATE KEY not working as expected?

Before I start, I'm not a web developer by trade. I'm self taught using google and StackOverflow. So I recently moved my site from a shared hosting to a VPS. My provider moved my site / files over ...
0
votes
4answers
445 views

Order by numbers followed by alphabet and then null values

I have below column in my database: abc 1 2 null 100 6 I want to sort and show these values as per below sequence: 1 2 6 100 abc null Anyone please help me to solve it. Consider below query: ...
0
votes
1answer
11 views

php single table language separated autoincrements?

I have 1 table for posts. And my columns are Id | id_language | lang I want to achieve, that there is a second autoincrement id for its language. For example the 80.post is the 5.post written in ...