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

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 ...

0
votes
0answers
3 views

Need help with counting the number of games which has quantity greater than 10 in php from the database and printing them

here is the code i have everything is good except i need to print the quantity of games i have which is greater > 10 in stock and printing it out just the like this picture i have here how can i add ...
0
votes
2answers
19 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
27 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
38 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
40 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
0answers
25 views

xxx.xx.xx.xxx via TCP/IP Database query failed Mysql [on hold]

I connect to mysql base, and get error, how to fix it ? xxx.xx.xx.xxx via TCP/IP Database query failed
0
votes
1answer
19 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
25 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
0answers
23 views

Trigger insert date auto

My Trigger BEGIN INSERT INTO PaletCDetay (PaletKod, Barkod, Urun, Kalibre, Kilo, Uretici) SELECT PaletKod, Barkod, Urun, Kalibre, Kilo, Uretici FROM UrunPaketDetay WHERE PaletKod =New.PaletKod; ...
0
votes
2answers
34 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
22 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
32 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
103 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
28 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
26 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
49 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
0answers
25 views

Access to database works on localhost; domain returns an error: “Access denied for user 'root'@'localhost' (using password: YES)”

<?php $servername = "localhost"; $username = "root"; $password = "Not Included"; //Password is not included, for security $conn = new mysqli($servername, $username, $password); ...
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
61 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
135 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
58 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
25 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
69 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
35 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
36 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
322 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
29 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
263 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
50 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
182 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
34 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
83 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
39 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 "...
0
votes
1answer
351 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
84 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
464 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
250 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: ...
-1
votes
1answer
34 views

how to fetch data according to the numbers i need [closed]

I have created a quiz website. all my questions are stored in the database and is fetched using SQL. I have a table for questions which contains question,their options and corresponding answer in ...
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 ...
0
votes
1answer
300 views

monthly report in mysql

can any body help me to edit this code to met requirements of charts pages i'm preparing for my project ? code : SELECT section, DATE_FORMAT( date_adm, '%Y-%m' ) AS datetime, COUNT( section ) AS ...
0
votes
1answer
41 views

Joining two tables in one has a subquery which is returning id count present in one table which is not presented on another field of a particular user [closed]

I have a two tables My first table goes in at this way CREATE TABLE `inventory` ( `id` int(64) NOT NULL, `user_id` int(50) NOT NULL, `placed_date` date NOT NULL, `name_of_campaign` varchar(...
0
votes
0answers
17 views

How to insert sql directly to laravel

I have an sql query as below. declare looping int default 0; declare current_status char (1); declare n INT DEFAULT 0; declare i INT DEFAULT 0; declare roomtypeid INT DEFAULT 0; ...
0
votes
0answers
43 views

Sql query issues in cake php

If I run this query in mysql - then its run I just want to show all record in payment table who's booking_status = 0 then it does not run in web page whats wrong with this query - SELECT `...
0
votes
1answer
30 views

error while converting sql to eloquent query

I have converted an sql query to eloquent like below: $roomtypes = DB::select(`rt.id`,`rt.type`,`rt.total_no_of_rooms`) ->addSelect(DB::raw(`SUM(r.no_of_rooms) as reserved rooms`)) ->...
0
votes
1answer
469 views

convert sql query to laravel

I have an sql qyery. SELECT rt.id, rt.type, rt.total_no_of_rooms , SUM(r.no_of_rooms) as "reserved rooms" , rt.total_no_of_rooms - SUM(r.no_of_rooms) as "rooms available" FROM Roomtypes ...
-2
votes
1answer
46 views

I want to make a database where an ID can have multiple records [closed]

I am currently making an inmate information system in which the admin can insert multiple visitations records for a certain prisoner This what my prisoner table looks like Visitations table: I want ...
-1
votes
1answer
28 views

Help with sql coding [closed]

I have a SQL database query that I'm struggling with. It uses 3 different tables that are inner joined but in order to get the results I want I need to load the team database table twice and import ...