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.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

My PHP file wont insert HTML data into a MySql database table

In Visual Studio Code, i am working on creating a website. An HTML page i have has a form that gets the user data... <form action="Data.php" style="position: fixed; top: 60px; left: 5px;" method="...
1
vote
1answer
13 views

does a php 7.3 cassandra driver exist?

I have php 7.3 on Debian 10. I'm trying to get the Apache Cassandra driver for php 7.3. The one provided by datastax (https://github.com/datastax/php-driver) only works up to 7.1, and the pecl one (...
0
votes
1answer
9 views

MySQL database getting connected with any username and password [duplicate]

We have a website running on an custom Ubuntu server managed and hosted by the client himself, since last two days the website database is getting hacked and someone deletes all the db tables from the ...
1
vote
1answer
21 views

Loop and array and sub array [closed]

I am working on a script that needs to loop an array and loop a sub array. I want to take in rows from a table (that piece works fine) that look like: invoice | item inv1 | it_A inv1 | it_C ...
0
votes
2answers
23 views

MYSQL Calculate ranking of row that is not yet inserted

I've got a table similar to this data: | id | username | value | |-----------|----------|-------| | 1 | bob | 46 | | 483 | alice | 90 | | 176 | sue | ...
0
votes
0answers
13 views

How to get rid of the “LOG: could not receive data from client: An existing connection was forcibly closed by the remote host.” error? [duplicate]

On Windows, my PostgreSQL window logs this regularly every day in its GUI window if I bring it up and look at it: LOG: could not receive data from client: An existing connection was forcibly closed ...
0
votes
1answer
34 views

How to properly add IPv6 data of GeoLite2 into existing table?

I'm building an application which will use MaxMind's GeoLite2 City database. By following a 2016 tutorial, I imported the data of GeoLite2-City-Blocks-IPv4.csv and GeoLite2-City-Locations-en.csv and ...
2
votes
1answer
33 views

Using PHP form to insert geometry from WKT and SRID into SQL Server 2017

I have a PHP 7.3 form that asks the user for a Name, a WKT and an SRID. I would like to upload the WKT and SRID to SQL Server 2017 so that it creates a geometric object in Upload_WKT_Test using ...
0
votes
1answer
46 views

Designing an ad banner tracker

I'm creating an ad banner tracker for the ad banners on my website by using PHP. The tracker would track unique impressions, total impressions, unique clicks and total clicks of each banner. The ...
1
vote
0answers
27 views

What All Is Factored Into A MySQL Checksum? (Why Could They Be Different?)

I'm currently going through the excruciating task of moving MySQL databases from one shared web hosting environment to another. This has been a multi-month battle (and I'm learning a lot). After ...
0
votes
1answer
37 views

PDO returning 0 rows on WHERE with enum

I am trying to build a query for a report. The report will have a few fields that can be filtered, one of which is a jobStatus field, it is an enum. Here is my query SELECT * FROM jobs j LEFT JOIN ...
0
votes
0answers
16 views

How to apply a condition based on values of a particular ID in a table?

I have a feedback table with FeedbackID. I have an action table with ActionID and FeedbackID and Follow-up. This implies that a particular FeedbackID can be related to several ActionID. In action ...
0
votes
1answer
40 views

Count up numbers from a specific column [closed]

Hi there was wondering if someone could help me out, and can give me a little code example. i have a table named "projecten", and columns named "pstatus and pafgifte" these columns have numbers only. ...
0
votes
1answer
18 views

Azure database - unable to locate in my Azure account

I have an Azure account where a developer that used to work with me has set up an MSSQL database on an Ubuntu VM. The PHP (CodeIgniter) system I am working on logs in (so database queries work ...
0
votes
0answers
31 views

Aborted connections (Erros reading communication packets)

I set up a new Database Server over a SQL Dump with innoDB MYSQL 5.7 from MYSQL 5.6. The Server running external with many sleeping SMTP connections over 1 Mio a day. I made the server open for ...
0
votes
1answer
50 views

Performance MySQL query with for loop

In this method, first I have to get sundays dates between two dates, in this case about 1 year. Then I go through the dates in a for loop and set them to the query. I use prepared statements to make ...
0
votes
2answers
402 views

Generate invoice number from 0 to so on for ordered products in orders table in php mysqli

I am trying to generate invoice number in orders table, like if user select 1 or multiple products and add it to cart then place order then invoice number should be same in our orders table for that 1 ...
-1
votes
1answer
48 views

Displaying data horizontally in mysql [duplicate]

I have this table in my db id | major | code_lesson | files Which the contents look like this id | major | code_lesson | files 1 | Math | MAT12 | mat.pdf 2 | Socio | SOC15 | soc.pdf ...
1
vote
1answer
34 views

Should I use VARCHAR or DATETIME?

I am making a blog cms system and the release date and time of the posts should be shown on my site. Should I save the Datetime in the php code with a function and save it in a varchar in the ...
0
votes
1answer
21 views

How to select 3 records before x ID and 5 records after x ID with Laravel Eloquent?

How can I select 3 records before x ID and 5 records after x ID with Laravel Eloquent or mysql?
0
votes
3answers
179 views

How Can I clone a database in Microsoft SQL server using PHP?

I am creating a portal where user can create the b2c or b2b store itself, so I need to clone the sample database to perform the task. It's not looking simple to clone the database in MSSQL. Please ...
0
votes
1answer
109 views

Change Data Capture in MySQL/PHP by writing to a MySQL table (rather than streaming to Kafka/Rabbit/etc)?

I have a small internal web app I'm developing with PHP and MySQL. I'm looking to sync client webpages to a server by requesting all changes since a certain date. I've found a number of solutions ...
0
votes
1answer
108 views

App Engine Standard connection to Cloud SQL Latency Randomly

I have a pretty "basic" app that we designed that was originally on a local plesk server and we migrated to GAE/GSQL/GCS. app engine, mysql, cloud storage. Here's some background info: App is PHP ...
1
vote
0answers
58 views

Multiple join with self join in MySQL and split column in row

I have four tables "Commission" , "Vendors", "Accounts" and "comsplitconfig" like commission Table commissionid vendorid accountid sales commission 1 V1 A2 ...
0
votes
1answer
131 views

MySQL query takes too long in codeigniter

I've made this query SELECT id,name,iupac_name,inchi_key,molecular_weight,molecular_formula,exact_molecular_mass FROM compound WHERE name LIKE '%quer%' OR iupac_name LIKE '%quer%' OR ...
0
votes
1answer
19 views

How to perform strictly SQL query that uses multiple values and searches all fields

I'm trying to create what I would call an "inclusive" search and by that, I'm not referring to "between". I have a snippet of code and it does what I need it to do but it's hacky and inefficient so I'...
0
votes
2answers
22 views

Value of prepared statement is listed as error in query string

I have made a Wordpress plugin that writes some data to a proprietary table. The query as shown in the log is: INSERT INTO berichten_devices (device_UUID, article_id) VALUES (%s, %s) If I take ...
0
votes
0answers
22 views

Why does this query return a result in MySQL but not in php?

I have a query that isn't returning a result in php for a certain search term (that I believe it should), but when I test it directly in MySQL, it does return one. Other search terms return fine. ...
1
vote
0answers
21 views

How to prevent a record from being affected by the ORDER BY RAND() function?

I am building an online exam site using php and mysql. It's just for MCQ type questions. Here is my database structure: 1) QUESTIONS ( Exam_ID, Questions_ID, Questions_Des) 2) OPTIONS ( Question_ID, ...
0
votes
1answer
14 views

How to prevent a record from being affected by the ORDER BY RAND statement in MYSQL

I have a series of problems all which I can't put in the title but I will try to explain them as best as I can. I am building an online exam platform with PHP and MySQL. Problem 1: Prevent a record ...
0
votes
0answers
78 views

How to show dynamic data row to data column in mysql or within php?

I have problem with query mysql. So I have database table and I've tried with my query like this SELECT GROUP_CONCAT( 'MAX(IF(day(tanggal) = ', day(tanggal), ', presensi, NULL)) ...
0
votes
1answer
34 views

Results not returning rows where second parameter should match null

I'm trying to left join three tables using columns from the first and third tables as the filters. The second and third tables could have null values where I am trying to join. I want to be able to ...
1
vote
0answers
65 views

MariaDB DELETE not removing all rows

I'm managing a MariaDB server and I noticed that an application run a DELETE query in a table each time the entity was saved and then it will insert the new rows referenced that entity. Sometimes ...
0
votes
0answers
31 views

How to prevent inserting same value in two columns in one Table?

I'm trying to solve problem which will compare BEFORE INSERTING columns values partnerCode and partnerCodeOwner1 with username in the table below, If partnerCode and partnerCodeOwner1 values same with ...
0
votes
1answer
164 views

Best Approach for PII and Databases

PII, or Personally Identifiable Information, involves information that may include the following, among other data: First Name Last Name Email Address Phone (any of them) Billing Address Shipping ...
0
votes
1answer
50 views

How can I write a trigger that can subtract values between two tables

I have a table called transaction that has these fields CREATE TABLE transaction ( transaction_id INT AUTO_INCREMENT, status varchar(255), myPIN varchar(255), amount_paid varchar(255)...
0
votes
1answer
32 views

MySQL: Can not add foreign key into create table statement

The queries below (assigned to php variables) seem to have an issue on the 2nd query, where I set the foreign key to the "couponId" column on the first table. My IDE lints "couponId" (inside the ...
1
vote
0answers
91 views

MongoDB / PHP - How to change data type for every occurrence of field in a document

I'm trying to learn how to use MongoDB with PHP. I Have built a web application that loads data from database etc. The issue I am having is that when I import my data from a .CSV using MongoDB Compass,...
-1
votes
1answer
52 views

How can I capture user IP address and store them automatically to my database? [closed]

am currently running an open voting system with no login form. I wanted to restrict double voting using user IP Addresses, how can I record user addresses direct to my database and use them to ...
0
votes
1answer
199 views

Cannot connect to MySQL using PHP 7 [duplicate]

The version of MySQL is 8.0.16. This is installed on an EC2 Linux and is a fresh install. I have run the mysql_secure_installation command after installation and was able to change the root password ...
0
votes
1answer
386 views

Php PDO Get all column names from table in specific database

I currently have the following query. Which fetches all column names for a table. But when there are 2 tables with the same name (in different databases) it fetches those column names as well. In ...
0
votes
0answers
21 views

mysql-5.7 and php5.6 - error on LONGTEXT Field type saying a 387 character long string cant fit in

Ok Here is my frustration cause: I've got this table structure: CREATE TABLE `blog_post` ( `bp_id` INT(11) NOT NULL AUTO_INCREMENT, `user_fid` INT(11) NULL DEFAULT NULL, `cat_fid` INT(11)...
-6
votes
1answer
26 views

I want to make drop down elements compulsory but unable to do so in php file [closed]

I want to make it compulsory for user to select one of the option in city , if he will not select the drop down option , the form will not submitted. But it is not happening...following is the code... ...
0
votes
0answers
261 views

mysql8 gives “Access denied for user” error with php but not navicat/workbench

I have been reading billions of answers/questions for that same error : SQLSTATE[HY000] [1045] Access denied for user 'root'@'ALEXPC' (using password: YES) I myself even handle this error like ...
0
votes
0answers
139 views

Calculate the SUM amount in daily basis Expense in sql/php

I want to get the total amount of Expenses in dail basis, if there is not Expeses posted/inserted THEN echo zero. this is the Code i have tried <?php $sql = "SELECT date(date) as td ,...
-2
votes
1answer
29 views

How to retrieve a users uploaded files using foreign key

I have two tables,users, and,files, Users Id,firstname,lastname,email,password files Id,filename,description,userid Userid in files is foreign key witch relates to Id in users I am trying to ...
0
votes
0answers
317 views

PHP slow with remote MySQL

I run ubuntu 18.10 and I've run into issues with a remote database server. I connect using a private network (by IP). The query in bash mysqlcommand takes about 9ms, while in the PHP software (eg. ...
1
vote
1answer
85 views

Mysql multiline statement causes syntax error

// php, using wordpress to send a raw query string $output = $wpdb->query(" INSERT INTO wp_priceGrids (gridId) VALUES (NULL); SELECT MAX(gridId) FROM wp_priceGrids; "); Results in: ...
0
votes
1answer
23 views

viewing a column in mysql database using php script

I'm trying to print a row from a table in mysql using a PHP script - here is the code but its not working - it shows Bad query apparently there is no issue: $conn = mysqli_connect($servername, $...
0
votes
1answer
50 views

Mysql join query improvement and GROUP_CONCAT on GROUP BY

I have two tables which I need to perform a left outer join on to get the result set I want. The query I have now works but its taking too long to process. Any suggestions? Query: SELECT Date_format(...