All Questions
Tagged with mysql javascript
42
questions
0
votes
0answers
16 views
Trying to secure a payment transaction with mysqljs2
In my web app, I am trying to secure a payment transaction, that is:
prevent users spending more than they have, especially in the case of concurrent execution
and prevent partial execution.
...
3
votes
2answers
104 views
Wordpress Ajax Custom Query - High CPU LOAD
I'm developing a fully AJAX community WP theme that comes with a lot of custom queries.
Everything is fine, there is no bug but recently but I had a few clients that have a huge database and my theme ...
4
votes
1answer
64 views
Correctly using promises with node-mysql
I have been trying to do a simple query and return the results with node-mysql however I had several problems. Originally I wrote it where there was no promise, but ...
2
votes
1answer
55 views
NODE JS Unlink and delete MySQL data
Here is my revised code from my other review question Node JS delete multiple MySQL linked records and delete physical file
Just would like to hear some reviews if I have the right logic.
...
3
votes
2answers
81 views
Getting data from database through Ajax post request
Is the method used below to get data from a database efficient and optimal? The data is in a MySQL database, and in my server I have a PHP file with the following code to return some information:
<...
0
votes
1answer
44 views
Scrape page and send user only new results
Review Wanted
Application Summary
The application is a simple screen scraper which is to notify the user when new items are posted.
The code is run as a CRON job every ten minutes. It will scrape the ...
2
votes
1answer
58 views
Dynamically inserting html from external file and updating the database
I need some suggestions on how to approach this. I want to allow users to create sections of website. The code so far is working but since I am new to back-end I feel like there is better, more ...
4
votes
3answers
919 views
Is my login system secure?
I am recently making a CMS and I need a secure login system, so this is my code. How is it?
First: the HTMLcode for signup and login:
...
1
vote
0answers
46 views
Optimizing Node MySQL Query for CPU Utilization
I am working on a NodeJS port listener code that listens to a particular TCP port on the server. The obtaining the data from the port, the data is split using a delimited (for instance comma ...
2
votes
0answers
76 views
Querying Aurora via Node.js
Function queries data from an Aurora database. Aurora database is the MySQL engine therefore, I'm querying it with a MySQL NPM module. If there is something better, I'm all ears.
The calling function ...
5
votes
1answer
8k views
MySQL data fetching without page refresh
I've recently finished a prototype for a little Raspberry Pi website. The main page of the site displays current users found in the room (through bluetooth). I wanted this list updated regularly from ...
1
vote
1answer
79 views
Authentication using express-session
I'm making an online shopping store or e-commerce and I use an express session for many things.
Example: Shopping Cart, Authentication user*
I store the data chart list in the database based on the ...
3
votes
1answer
10k views
Convert all dates in an array to date format
I'm returning an array containing dates (and other things) from an API, then looping through the array on the front end to convert them into dates
The backend uses Node.Js and queries a mySql ...
2
votes
0answers
836 views
Async/await Mysql wrapper
I used MySQL, but it was inconvenient so I made a wrapper.
It works, but I'm unsure if there are any issues.
Used node module - mysql2, bluebird
sqlWarpper.js
...
3
votes
1answer
38 views
Handling download requests using PM2
I Using Nodejs v9.10.1 for handle download operation from another application. When using PM2 in fork mode to make alive my code. After 50 minutes, this will show high memory usage.
Server Config is ...
1
vote
2answers
909 views
Router for quering MySQL results in NodeJS
What should I consider in order to refactor the following code ?
It seems very close to proudly become a Pyramid of Doom:
...
2
votes
1answer
84 views
MySQL Connection URI Regular Expression
I'm currently working on a project that involves a MySQL database. To make life a little easier, I've been working on a regex that should validate and pull apart the different sections of the ...
1
vote
0answers
4k views
Using async/await with Node.JS MySQL
Is this the right way to use async/await with the JavaScript MySQL client? I had to use the promise-mysql package because it wraps the function calls with Bluebird promises, so that I'm able to use ...
1
vote
0answers
388 views
Connecting MySQL with connection pool in NodeJS
I'm trying to connect to a MySQL database in NodeJS. It seems it is creating multiple pool connections from multiple sources, instead of using the old one.
If I try this in MySQL console:
...
1
vote
2answers
16k views
Displaying MySQL table data using Node.js
I'm trying Node.js for the first time, everything works, but i'm not sure that my approach is right, can you tell me if it's ok?
In this test, i've tried to get ...
1
vote
0answers
123 views
Fetch key from MySQL DB if doesn't exist in redis DB
This code gets data from a MySQL database, such that if a key doesn't exist in a Redis database, then fetching of data needs to be done from the MySQL database and then stored in Redis cache. As such, ...
1
vote
2answers
8k views
Using AJAX to look up MySQL value using two dropdown inputs
I have a list of cities, and a set of "travel time" between any given two cities. The "travel time" is fixed and not necessarily dependent on absolute distance between the two cities, and it currently ...
5
votes
1answer
586 views
NodeJS/Express/socket.io backend
I have the backend of a socket.io script running in NodeJS for a web application. A user can login to the site and join a project collaboration (group of users linked to a project). Each project has a ...
3
votes
0answers
63 views
A function that debits a virtual wallet and calls an API to disburse to a real account
I am trying to determine if there is a better way to handle reversals for this function.
This is how it works:
A user inputs in amount, bank, and account number this would be used to debit his ...
1
vote
0answers
413 views
Scraping websites and saving to MySQL
I have the following piece of code which scrapes websites and saves some information back to MySQL.
At the moment is consuming all the memory on my machine every time it runs.
I've refactored the ...
2
votes
0answers
458 views
Chat application built with Node
In an effort to teach myself Node.JS and truly delve into its communication capabilities, I elected to recreate a previous chatting project. It took a bit of forethought to acclimate code to the ...
7
votes
1answer
22k views
Passing Node.js SQL connection to multiple routes
Here are the app.js, users.js and user.js routes of a node application I am building. As you can see I am connecting to the SQL DB in each route, and this is not ideal. I have tried passing the ...
7
votes
2answers
185 views
Student status form
I'm programming a system and I want to know if this is the correct way or if there is a better way to do it.
Container:
I have more fields but I only added one to show you the container.
...
4
votes
2answers
4k views
Calculator using PHP with logging to MySQL database
I have made a calculator in PHP and I need some feedback in terms of security and performance or any other general improvements.
You can download a zip file with all the contents from this link if ...
2
votes
1answer
665 views
Managing a user database
In my system there are 3 main functionalities:
Add users to database
Delete users from database
Updater users
This is the screenshot in my UI:
When clicking on the button of add new user, a ...
4
votes
1answer
587 views
Random select in two MySQL tables
I wrote a simple AJAX request that performs a random select in two MySQL tables. My current script involves connecting to the database and creating a new PDO every time the ...
3
votes
1answer
98 views
sed-like attempt from database
The following code and test data works, but I have had to add delays between writes to MySQL otherwise it acts funny (especially on the target data set which is over 700 rows). The table is simply a ...
0
votes
3answers
4k views
3
votes
1answer
511 views
My node app with valid syntax is failing silently, but not breaking. Infrastructure problem?
I built a simple Node app, and the code "works", with no failures, no syntax errors, and does not break, but one component doesn't work right. I showed a snippet on Stack Overflow, in this question, ...
3
votes
1answer
2k views
Dynamically-loading interactive table
I've got a page on a website that shows a table, and upon clicking on a row in the table, it can dynamically load in more results. I am new to jQuery though.
index.php page:
...
8
votes
2answers
286 views
Local user registration
More javascript (nodejs) to go with the passport wrapper I just posted:
UserBook.js
...
2
votes
2answers
7k views
Chat with PHP, MySql, Ajax: How to improve it?
I made this simple chat in php. You have suggestions on how I can improve it?
This file configures the connection to the server
This file is a simple form "login" ( only username required )
<...
-1
votes
1answer
102 views
How to change my code to jquery [closed]
I have wrote few function that grab the values from a form page and pass them to PHP
is there a way to write it better
...
3
votes
2answers
350 views
Better way to return data via AJAX?
Let's say I have three files: a page that is used for searching data called search, a file that handles requests called controller, and a file that has functions which the controller calls based on ...
-2
votes
1answer
141 views
How can I improve my search script? [closed]
I have this search script on my page which search through the displayed table. The table is displayed with PHP from a database. It is actually a list, and this list is sorted out alphabetically with ...
1
vote
1answer
151 views
<select> has extra blank <option>'s and I have no idea why. please help me get them out [closed]
This is the result of the code it has extra option tags no idea why.
I have no idea why It produces the extra option box.
Below is the result of the query. Correct number of rows correct response......
2
votes
1answer
879 views
Polling script to determine the continuous time a user has been connected
I've been asked to keep track of how long a user has been connected to a site without interruption.
So far the solution I've come up with is to use ajax to poll the site every now and then to check ...