Questions tagged [mysql]

MySQL is a widely popular and accessible Relational Database Management System (RDBMS) that operates on the Structured Query Language (SQL). It should be noted that this designation exclusively applies to MySQL and not other databases like SQL Server or SQLite, each of which possesses their own unique SQL dialects for managing data. While seeking assistance, it is crucial to mention the specific version of the server being used in order to accurately address any potential issues as capabilities can vary significantly between versions 5.x and 8+.

Retrieve all the records from the MySQL table that correspond to the user's postcode

I'm attempting to showcase a list of users who reside in the same area as the currently logged-in user. In simpler terms, if the logged-in user has a postcode starting with 'm3 4', then any other user(s) with the same prefix will be displayed. Here's an e ...

What is the best way to mass import users by uploading a CSV file in a nodejs application?

I have a scenario where I need to add multiple users in my database by uploading a CSV file. The CSV file contains three columns: first_name, last_name, email. How can I achieve this using my existing user model and controller? Model.js const User = sequ ...

Saving a session variable to the database using ajax technology

If you're like me and struggling to figure out how to add a session variable (username) to a database using ajax, I've been there. My limited knowledge of jQuery and JavaScript made it quite the challenge. The dynamic table I'm working with ...

In Laravel 5, the firstOrCreate method ensures that a new record is created if one doesn't already

Displayed below is the code snippet from my app's Cart.php use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Cart extends Model { use SoftDeletes; protected $table = &apo ...

Is there a way for me to determine the value or array that has been passed in the form?

I am facing a challenge and need help solving it. I have a project that involves interacting with a database, where I created a CRUD HTML table for data manipulation. There are 15 tables in the relative database, and I need to insert, delete, and edit reco ...

The differential treatment of arrays' values in comparison to manually inputted values

Here is a function that I have: public function getReward($formattedArray, $key){ $id = $formattedArray[$key][0]; //dd($id); //Returns 1 $reward = Item::find($id); return $reward; } The problem arises when executing this part of the code ...

Building a customised-schema table for storing data with express-mysql-session

I am exploring the option to store the user id in the MySQL Database's sessions table using express-mysql-session. Initially, I set the user id in the middleware as shown below: import "dotenv/config"; import express from "express" ...

Utilizing HTML forms in combination with Google Charts to generate interactive graphs

Recently, I've been working on a project where I'm trying to incorporate Visual Analytics. I'm looking to create a graph from a UI that's part of an HTML form. Below is the code snippet from my HTML page: <!DOCTYPE html> <html& ...

In my database, I have two tables: Table1 and Table2. To better illustrate my issue, I have included a picture for reference

https://i.stack.imgur.com/GQAMy.jpg I am facing a challenge with joining two tables, table1 and table2, in MySQL. I need assistance in creating the resultant table as shown in the attached picture. Your help in solving this issue would be greatly appreci ...

Step-by-step guide to uploading an image with node.js, MySQL, and Express

Having recently delved into the world of Node.js, I came across a helpful tutorial on this website that taught me how to create REST APIs using Node.js. Now I'm trying to figure out how to upload an image file using Node.js and save it in a MySQL table. ...

Converting Data from MySQL and PHP to Excel

Is there a way to export human resource applications stored in my MySQL table as an Excel file? function exportExcel($filename='ExportExcel',$columns=array(),$data=array(),$replaceDotCol=array()){ global $connect; header('Content-Encoding: UTF-8'); ...

Error Alert - Troubleshooting AJAX JSON Parsing Issue

I've encountered a problem with AJAX that involves parsing a JSON Array from a webservice I am developing. The front-end of my project uses a simple combination of ajax and jQuery to showcase the results retrieved from the webservice. Despite being certai ...

Struggling to insert a JavaScript variable into a MySQL database table using PHP and AJAX

As a newcomer to these technologies, I've been struggling all day with what I expected to be a simple task. My goal is to pass a parameter from a JS function to my PHP code using AJAX and then insert that parameter into my database. Here's the JS function ...

Trouble arises when attempting AJAX call to PHP file resulting in failed MySQL execution accompanied by errors

Having some trouble identifying the issue here. It seems quite simple, but I'll highlight it here anyway. On a basic website, I have a form for user registration where I'm using AJAX to send data to register.php. The form and AJAX code are as follows: ...

Assigning background colors based on the data stored in a specific field of a MySQL database

I have successfully implemented a Ticketing System using PHP and MySQL database. The view tickets page displays each ticket from the database along with its priority level, which can be Low, Normal or High. Currently, the priority value pulled from the d ...

Guide on Retrieving the Most Recent Database Entry with the Aid of AngularJS and PHP

I have developed two unique web pages. One is called BookTicket which contains a form with two buttons. The first button submits the form and stores the information in a database, while the second button navigates to a payment page. The other page is cal ...

Saving a JSON data structure in a storage system

Currently faced with the challenge of storing JSON data in a MySQL database, I am struggling to identify the most efficient method. { "id":"9", "title":"title", "images":[ { "image":"house.png", "width":"680", "height":"780" },{ "image":"car.png", "width" ...

Increase the efficiency of MySQL InnoDB queries in your PHP application

I've encountered some issues with the code in my PHP/MySQL application. While it generally runs smoothly and takes about 3-4 seconds, the first execution (per session) can take up to 2 minutes. I suspect this delay is due to certain automated cache mechani ...

Is there a risk of collision when using PDO and mysqli at the same time?

Currently, our main database connection is using mysqli. However, we are considering transitioning to Doctrine DBAL, which is built on top of PDO, a more flexible database abstraction layer. The game plan is to gradually shift from mysqli to DBAL while re ...

Bookshelf.js - Extracting a specific column from a joined table

I am currently working on setting up a many-to-many relationship between my User model and Course model. Users can join multiple courses, and courses can have multiple users (students). To add a unique twist, I am adding a monthly quota of questions that u ...

Managing data updates in web applications with "has many" relationships

I've encountered a recurring issue in my web application development projects and I'm looking for some advice on how to handle it more efficiently. Currently, when editing data with multiple relationships in an app that uses MySQL as the database ...

The data in my MySQL table is not appearing on an Angular Material table when using Node.js

HTML file content <table mat-table [dataSource]="dataSource" class="mat-elevation-z8"> <ng-container matColumnDef="id"> <th mat-header-cell *matHeaderCellDef> No. </th> <td mat-cell *matCellDef="let element"> {{ele ...

Having trouble with jQuery AJAX POST request to PHP script for database updating not functioning properly

I am currently in the process of creating a small CMS system and am looking to incorporate AJAX and jQuery into it. Although the code works fine without using AJAX, I am facing issues with data not being passed correctly. The AJAX success message displays ...

How to show a picture stored in a MySQL database using PHP

I have been experimenting with displaying images uploaded to the database using a simple insert form. So far, I have managed to retrieve the image name in the "data-file". However, I am curious about how I can easily display the actual image in the same lo ...

Dynamic database switching in Node API REST services

Is there a way to dynamically switch the database configuration for my pool in Node/Express application? I am using a REST API with node/express and have multiple databases. What I need is for the API to select the appropriate database based on the user.c ...

generate an extensive XML document

I work with Flex and PHP with a focus on querying MySQL databases to create XML files using PHP functions. Typically, the recordset can be extensive, containing around 90000 rows which slows down the generation of the XML file to approximately 50 seconds. ...

Can the $_SESSION[balance] be updated automatically?

On each login, I retrieve the value of $_SESSION[balance] from a MySQL database. Is there a way to update this value in the client's browser every 5 minutes without refreshing the page? Could AJAX be used for this purpose? I apologize if my question is to ...

PHP query will execute even in the absence of clicking the button

I'm encountering an unusual issue. I've defined a query to insert two names into the database, and I've used Javascript(Jquery) to ensure it only runs when the create button is clicked. However, the script seems to be executing every time I reload the page ...

Sorting DateTime in MYSQL using PHP

I have stored the date in a MySQL datetime field as shown below: $current_date = date('Y-m-d H:i:s'); It will save the datetime like this: 2012-12-19 14:36:42. Now I need to retrieve the following data using a MySQL query: 1) Get all data tha ...

Combining PHP and MySQL with a join statement

I am trying to calculate the average rating for each store in a directory list using MySQL's AVG function. Whenever someone reviews a store, they assign a rating ranging from 1 to 5. This rating is then inserted into the rating column of the reviews table ...

how to use ajax to retrieve a value returned by a php function

I have two different files, one named index.php and the other called get_content.php. Strangely, I am unable to display anything on the get_content.php file. I am now left pondering where the issue might be - in index.php or get_content.php? To view the F ...

I am having trouble inserting my data into a MySQL database via PHP

I am currently tackling a school project and struggling to complete the registration page accurately. The data does not seem to be getting inserted into the table as intended. Please take a look at this screenshot of the database and table After reviewin ...

What causes the MySQL pool to become undefined when accessed in a member function after being assigned to a member variable?

I am currently working on setting up a connection pool for queries in my project. I have created a simple class where the connection pool is assigned to a member variable. The issue I am facing is that even though the member variable is correctly set in th ...

Tackling the issue of memory leaks in Node.js when dealing with a high volume of frequent

TL;DR https://gist.github.com/anonymous/1e0faaa99b8bb4afe3749ff94e52c84f - Example demonstrating memory consumption indicating a potential leak issue. Is the problem in my code or within the mysql package? Extended Version : I've been noticing significa ...

Retrieving information from the table based on the user currently logged in

I have a scenario with two different tables, NGO and Volunteer. When a volunteer selects an NGO to work with, I want to display only those volunteers who are interested in the current logged-in NGO. Below is the code snippet I am using: [<?php ...

Encountering the PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR when the database transitions to an Idle state

Outside of regular operating hours, the database transitions into an Idle state. To re-establish connection to the data, I am using the code snippet below, var mysql = require('mysql'); var settings = require('./config.js'); var conne ...

Executing multiple loops of MySQL queries using PHP

There are two tables that are crucial for a trivia quiz game at this stage: scores and quiz. I have implemented multiple nested PHP and MySQL loops to achieve the desired results. However, I am seeking a more streamlined approach with potentially fewer dat ...

Sending a JWT token to a middleware with a GET request in Express Node.js - the proper way

Struggling with Js and web development, I've scoured the web for a solution to no avail... After completing a project for a small lab, my current challenge is creating a login page and generating a web token using JWT... I successfully created a use ...

How can I use PHP to update and select on the same page simultaneously?

Having always been able to do something similar in other languages, I'm facing a few difficulties with PHP. My goal is to load a page that displays all the values from a form (created with a SELECT) and then update them all when clicking a "CHANGE" button ...

"Troubles Encountered While Trying to Create a Database Record Using

I am currently facing an issue while attempting to write to a database using PHP. Despite having asked for assistance from multiple individuals, the problem still persists. Therefore, I am reaching out in hopes that a fresh pair of eyes might be able to ...

Struggling to retrieve JSON data from MYSQL database to Android App? Reach out for assistance with

I'm currently working on an Android application that interacts with a remote MYSQL database to retrieve information using JSON data. One of the challenges I'm facing is implementing a search functionality based on the userID in the app, and then displaying ...

In situations where tables have multiple rows, I prefer to append an auto-increment suffix to the end of the field name and consolidate all data into a single array

I have a database that contains more than 10 SQL tables with employee details. Some tables only have single row details, like the basic details table which is the main table. In the second table, the contact table, I index this table with id=emp_id and lef ...

Query: What is the best method for calculating the distance between various sets of latitude and longitude coordinates?

Exploring the idea of creating a LAMP web application that allows users to input their location. Considering integrating Google Map API to convert their locations into lat/long coordinates. Assuming every user has this information, I am looking for guidanc ...

Make sure to refresh the node.js express api every minute with the latest timestamp available

I'm currently working on setting up a Node.js Express API to expose a MySQL table. Everything is working fine except for the part where I need to filter data by a current timestamp and update it every few minutes. I've tried using setInterval but ...

How to Retrieve Data from an HTML Table using the Laravel Framework

I have a unique and interactive Dynamic Sortable Table where I can effortlessly add or delete rows likethis uploaded image here. There is an intriguing loop in my controller that runs precisely 4 times, based on the number of columns in the table. However, ...

Removing a row using join operation

After setting up two tables, simplecomments and commentors, I linked them using an INNER JOIN. The Simplecomments table contains detailed information about each commenter, including their comment, registration date, and commenter ID. On the other hand, ...

Is it possible for a MySQL loop to only delete the first entry?

My MySQL looping is not working properly when I click the second button to get their id and continue with the rest of the process. Why is this happening? $(document).ready(function() { $("#deleteSchedule").click(function (e) { e.preventDefault(); ...

What is the best way to retrieve the most up-to-date status for every identifier in the table?

Here is a table for reference: mysql> desc foo; +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+------------- ...

Is there a way to dynamically retrieve markers from a MySQL database?

Within my MySQL database, I have stored marker positions (along with additional information) that I successfully loaded onto a Google Map by following this example - http://code.google.com/apis/maps/articles/phpsqlajax.html Everything worked perfectly up ...

Using PHP to update MySQL on Android by sending data in JSON format

I attempted to create an activity that would update a MySQL database. Here is the code for the web server: <?php //error_reporting(0); require_once('db_config.php'); if($conn){ $sql = "UPDATE order_detail SET order_status ='co ...

Present data extracted from MySQL

Currently, my code retrieves data from a MySQL table and displays it on the page in a single line. However, I want to present this information in separate blocks. Is there a way to split the line and create distinct blocks of information that can be plac ...

Import CSV data into MySQL database using PHP

Here is some PHP code: $handle = fopen($_FILES['filename']['tmp_name'], "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $import="INSERT into info(tazkira,gender,province,category,clin,training) values('$data[0]','$data[1]','$data[2]', ...

SQL retrieve data sorted by result column and return it as an array

Wondering if it's possible to retrieve groups as an associative array using SQL. I'm interested in understanding the capabilities of SQL and its potential for solving this particular issue. The challenge at hand involves a database containing a ...

What is the best way to compare a JSON object with a string in an Android application?

Here is the code snippet that functions correctly by displaying content when the EditText field is left blank or contains a string value present in the MySQL database. However, I am facing an issue where I want to show an error message when the input from ...

Arranging items by cost with the help of ajax and php

After successfully implementing product filtering using Ajax and PHP on my real estate website, I'm now facing issues while trying to incorporate the functionality to order the results by price. Despite various attempts, I am unable to add the necessa ...

Parsing JSON array values with dynamic keys into JSON_TABLE with consistent columns

I am facing a challenge with JSON data being imported into my MariaDB/MYSQL database using Airbyte from an API query. I have been using JSON_TABLE to extract the JSON into columns, which has been working quite well. However, I recently noticed that there i ...

The PHP/MySQLi registration form is displaying a blank white page without any visible output or error messages

Hey everyone, I'm currently working on a simple registration form in PHP and no matter how many times I try to run it, all I get is a blank white page. There are no errors or outputs, just pure emptiness. I was hoping someone could shed some light on ...

What is the best way to update entire URLs on my website?

Currently developing a PHP website. Can anyone provide guidance on how to substitute spaces in a URL with either dashes (-) or %20? Which function should be utilized to decode the URL? Is it necessary to modify anything in the .htaccess file? ...

Leveraging TypeORM with MySql in a Node.js Lambda Function

I am currently attempting to create lambda functions in node.js using TypeORM with MySql. Despite installing all the necessary node modules, I encounter errors when deploying the lambda (via serverless) and testing it. The error message is as follows: I am ...

Utilizing Scrapy to Fetch Data from a MySQL Database and Web Scraping

I currently have a spider and pipeline set up to extract data from the web and insert it into MySQL. This code is up and running smoothly. class AmazonAllDepartmentSpider(scrapy.Spider): name = "amazon" allowed_domains = ["amazon.com"] start_ ...

Issue in executing a mysql query using the Python library PyMySQL

I am encountering an SQL query error with the second SQL statement in this code. I understand that the issue lies in escaping the single ' quote, but I'm unsure how to handle it within my parameters. This marks my first question. My second question pertai ...

Why is my data not updating in the database with PDO?

I'm currently facing an issue with updating my database using PDO. While I can easily select data without any problems, the update function just doesn't seem to work. There are no error messages displayed, but after running the query, there are no changes ...

Issue: Unrecoverable Fault Encountered During MYSQL Script Execution

I'm currently working on integrating MYSQL with Python CGI-Bin. However, I keep encountering an issue that I can't seem to resolve. I am running this on a Windows 8 machine with Python version 2.7.8. I've searched online for solutions but have been unsucc ...

Is there a way for me to create a clickable link from a specific search result retrieved from a MySQL database using an AJAX

Currently, I am attempting to create an ajax dropdown search form that provides suggestions based on results from a MySQL database. The goal is for the user to be able to click on a suggestion and be redirected to the specific product. The code I am using ...

Calculate the number of posts in a monthly archive using PHP

I am trying to display the number of news articles per year and month in the following format: 2013 October (20) November (45) September (80) 2014 January (5) This is what I currently have: $sql = "SELECT YEAR(FROM_UNIXTIME(timestamp)) AS YEAR, ...

What is the solution for the issue of encountering an undefined key array email while attempting to log in through the form?

I encountered an issue while working on a login form that communicates with the database using PHP at the backend. Even though I have verified the correctness of my login credentials, I am facing an error related to undefined array keys 'email and pas ...

Modify radio buttons using PHP and MySQL editing feature

Hey there, I'm trying to check whether the radio button in (photo_edit.php) is set to 0 or 1, but it seems like all fields are empty. <td> <p> <input type="radio" name="visible" id="visible" value="1" /><?php echo (@$ ...

Creating a multilingual website using PHP, MySQL, and cookies

Having developed a multilingual website using PHP and MySQL, I am currently facing issues related to robots, SEO, and search engines. This is mainly due to the fact that the language selection mechanism relies on cookies. The current process is as follows ...

Issue with jQuery and AJAX on the webpage

I've recently implemented the search functionality using AJAX jQuery, but I am facing a problem. Currently, when I type something in the search field, the search list displays accordingly. However, upon refreshing the page, the search results disappear. Th ...

Retrieve the information following a redirection

There is a page '/order/new' with 2 dropdown menus for customer and their address, along with a button that redirects to choose products to add to the order. The selected products are saved in an array called 'hh' which receives data from an AJAX call. How ...

"Enhance your database by incorporating HTML link clicks through AJAX integration with PHP and MySQL

After browsing through similar questions and attempting to implement it on my website, I'm facing an issue where the expected functionality is not working as intended. When users click on a link, there is no response in the console, and the database r ...

Converting JSON-style data into a string with the power of node mysql

Just a quick note - I'm a total newbie in the world of web development, so I might be missing an obvious solution here. My challenge is to insert a dataset into a MySQL database using nodejs/expressjs/mysql. I've managed to establish a connection to the ...

What are some strategies for completing time-consuming tasks in PHP within a 30-second execution time limit?

While parsing data from a text file to a MySQL database, I encountered an issue after processing a certain number of records (approximately 250,000 to 380,000). The error message Fatal error: Maximum execution time of 30 seconds exceeded appears. Splitting ...

creating a live updating dropdown menu using Node.js and MySQL

Upon a user clicking and selecting a client, I would like to dynamically update the region dropdown menu with options that are related to that specific client from the databaseenter code here This is my client table: Here is the Region table, where clien ...

Utilizing PHP variables to filter data in my MySQL query

When attempting to execute a SQL selection using PHP variables, I encountered an issue with the following code: $st=$_POST["st"] ; $tu=$_POST["tu"] ; $data=$_POST["data"]; $ec= $_POST["ec"] ; $sql="SELECT nr, '.$ec.' FROM 'report' WHERE st='.$st.' and t ...