0

I'm trying to INSERT multiple records into a MySQL database with data gathered from the command line prompt but the data is not showing that it was stored when the SELECT * FROM script is executed.

No errors after completion of the command line prompt but the MySQL result returns 0 rows No errors after completion of the command line prompt but the MySQL result returns 0 rows

nbk
  • 45,398
  • 8
  • 30
  • 47
  • 1
    Please post your code as text, not image. – Barmar Oct 12 '20 at 14:43
  • `affectedRows: 1` means that 1 row was inserted. – Barmar Oct 12 '20 at 14:45
  • please take a look at prepared staemente for node js https://stackoverflow.com/questions/15778572/preventing-sql-injection-in-node-js – nbk Oct 12 '20 at 14:47
  • @nbk He's using that method. – Barmar Oct 12 '20 at 14:48
  • It looks like you're doing it correctly according to https://stackoverflow.com/questions/8899802/how-do-i-do-a-bulk-insert-in-mysql-using-node-js – Barmar Oct 12 '20 at 14:49
  • @Barmar The affected rows through me off because when I'm directly in MySQL workbench and run SELECT * FROM the database returns nothing. If the message says 1 row was inserted how come it's not showing the database. – Kimani Kelly Oct 12 '20 at 14:55
  • I can't explain that. – Barmar Oct 12 '20 at 14:57
  • check if you are connected to the right database – nbk Oct 12 '20 at 15:24
  • @nbk Sorry for the confusion my database was properly connected and querying the data from the command line prompts. The reason I was not able to view the stored data in MySQL workbench was that I was using the wrong script execution button. Every time I ran the script the database would create itself again and delete the table contents. I was able to use the 'Execute the statement under the keyboard cursor' button with the cursor under the SELECT * FROM script. Thank you for the time and effort you both put in to help me solve this issue. – Kimani Kelly Oct 12 '20 at 16:25
  • @Barmar I was able to correct the issue and view the database table in MySQL workbench. – Kimani Kelly Oct 12 '20 at 16:26

0 Answers0