Skip to content

Instantly share code, notes, and snippets.

async function addToCart(orderid) {
let sql = `CALL add_to_cart(?);`;
let res2;
res2 = await db.query(sql, [orderid]);
console.log("addtocart", res2);
console.info(`SQL: ${sql} got ${res2.length} rows.`);
return res2[0];
}
@churchthecat
churchthecat / wp-itapi.php
Last active February 17, 2020 18:48
wordpress installation
1
2
3
4
5
6
7
8
9
10
async function nyLon(akronym, lon) {
const db = await mysql.createConnection(config);
let sql;
let res;
let str;
let akr1 = `${akronym}`;
let lon1 = `${lon}`;
console.info("")
sql = `
UPDATE larare SET lon = (lon1)
@churchthecat
churchthecat / ddl_all.sql
Created February 13, 2020 14:09
ERROR 1005 (HY000)
får följande fel:
MariaDB [skolan]> source ddl_all.sql
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Utan: const mysql = require("promise-mysql");
const config = require("./config.json"); i början av teachers.js ger felet:
anders@andershpjobb ~/BTH/Dbwebbkurser/databas/me/kmom02/search $ node teachers.js
(node:13696) UnhandledPromiseRejectionWarning: ReferenceError: mysql is not defined
at /home/anders/BTH/Dbwebbkurser/databas/me/kmom02/search/teachers.js:11:16
at Object.<anonymous> (/home/anders/BTH/Dbwebbkurser/databas/me/kmom02/search/teachers.js:59:3)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
anders@andershpjobb ~/BTH/Dbwebbkurser/databas/me $ dbwebb update
Update course-repo with latest changes from its master at GitHub.
remote: Enumerating objects: 50, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 38 (delta 22), reused 34 (delta 19), pack-reused 0
Unpacking objects: 100% (38/38), done.
From https://github.com/dbwebb-se/databas
38d97ae..9ffd048 master -> origin/master
Updating 38d97ae..9ffd048