Im trying to insert some data into a SQL table but Im getting nothing from the front or back end I have tried console.log at various intervals but I cant seem to get data from either side. For reference I have table called products with three columns id, name, image Im trying to insert both name and image with a
Tag: reactjs
Prisma PostgreSQL queryRaw error code 42P01 table does not exist
I am trying to run a query that searches items in the Item table by how similar their title and description are to a value, the query is the following: However when the code is run I receive the following error: I have run also the following query: Which correctly shows that the Item table exists! Where is the error?
req.query returns nothing
Trying to get variable from http://localhost:3000/categories/subcategories?category_id=13 but req.query returns empty result. Is this possibly a problem with the way I’ve set up my server? Answer See how you are passing the data , directly entering the data or from another URL you are passing the data. Ensuring you are not sending data via req.body. Ref : Empty req.query on ExpressJS
REACT: SELECT from MYSQL
i a new user and a new in React world. I need help to solve this situation about a Select with values from mysql DB. I receive the values, but the select goes in infinite loop. The error is surely in this file cause server.js works without problem!! Really thanks for the help, and sorry if it could be a
React Form won’t save date
I’ve created a basic form in React to save a name, category, and date if available to an SQL table. My form is acting fine – it’s submitting correctly and saving the new entries. The problem is, while it saves the name and the category fine, if you choose a date (using the HTML date picker) the date isn’t getting
Converting sql data to json but json file include recordset
I’m trying to convert sql data to json data but when file is completed I get something ‘recordset’ what is this and how do i get rid of it. —–This is how I am getting the json .— Please tell me how i get rid of recordset, square brackets and output and rowsafftectd Answer Well, you just need to stringify
Optional variable in Graphql
I have a graphql query like this: when i run this it expects a id as variable. How can I make that variable optional? It should display all results when no id is given Answer There’s no way that I’m aware to declare a variable as optional but also have it ignore the rest of the expression in the way
How to show multiple tables list in MySql
How to show multiple table list in mysql I have a query that has two tables one for patients and the second one for patients who has tested for covid-19 I want to show all the patients either they tested or not If tested then show the result with his/her name It only showing the patients who has tested for
How to pass a question mark express router api to update sql
I want to update a varchar field (String) using and End-Point Api (Express NodeJS) but I have problem went I pass invalid inputs like question mark. Express End-Point: This code work fine: http://localhost:3001/api/updateField/posts/TITLE/When/1/1 But this NOT WORK: http://localhost:3001/api/updateField/posts/TITLE/When?/1/1 I send the request from react like this: Answer Use javascript function encodeURIComponent() to escape special characters in URL parameters. For example
How to not insert two of the same values
I’m using an input to allow user’s to select files from their computer and add it to a list. I’m doing this by using a promise to load the files and creating an array of promises and adding that to my state React JS I’m then mapping through my files array to add those files to a list of text