PHP PDO Command Line Script - back


Script started on Mon 25 Sep 2017 02:27:57 PM EDT
pi:~/public_html/coursework/isc496/assignments/a4> php tables.php

Created/opened the database

Created table english

Created spanish table

Created translate table

pi:~/public_html/coursework/isc496/assignments/a4> php insertswlite3qlite3 pdo.db

SQLite version 3.11.0 2016-02-15 17:29:24
Enter ".help" for usage hints.
sqlite> .column mode column
sqlite> .schema
CREATE TABLE english( id INTEGER PRIMARY KEY,lexeme VARCHAR(255) UNIQUE NOT NULL);
CREATE TABLE spanish( id INTEGER PRIMARY KEY,lexeme VARCHAR (255) UNIQUE NOT NULL);
CREATE TABLE translate( id INTEGER PRIMARY KEY,en INTEGER UNIQUE NOT NULL,sp INTEGER UNIQUE NOT NULL,FOREIGN KEY(en) REFERENCES english(id)FOREIGN KEY(sp) REFERENCES spanish(id));
sqlite> select * from english;
sqlite> .quit
pi:~/public_html/coursework/isc496/assignments/a4> 

pi:~/public_html/coursework/isc496/assignments/a4> php inserett1.php

Created/opened the database

0 => hello, hola
hello|hola|
inserted 'hello' into english
row id is 1
inserted 'hola' into spanish
row id is 1
inserted 1, 1 into translate
1 => science, ciencia
science|ciencia|
inserted 'science' into english
row id is 2
inserted 'ciencia' into spanish
row id is 2
inserted 2, 2 into translate
pi:~/public_html/coursework/isc496/assignments/a4> sqlite3.p pdo.db

SQLite version 3.11.0 2016-02-15 17:29:24
Enter ".help" for usage hints.
sqlite> .mode column
sqlite> select * forrom english;
1           hello     
2           science   
sqlite> select * from spanisshh;
1           hola      
2           ciencia   
sqlite> select * from translate;
1           1           1         
2           2           2         
sqlite> .quit
pi:~/public_html/coursework/isc496/assignments/a4> php insert2.php;

Created/opened the database

0 => laptop, ordenador portátil
Test 1 

laptop|ordenador portátil|
inserted 'laptop' into english
row id is 3
inserted 'ordenador portátil' into spanish
row id is 3
inserted 3, 3 into translate
1 => internet, internet
Test 1 

internet|internet|
inserted 'internet' into english
row id is 4
inserted 'internet' into spanish
row id is 4
inserted 4, 4 into translate
pi:~/public_html/coursework/isc496/assignments/a4> sqlite 3 pdo.db

SQLite version 3.11.0 2016-02-15 17:29:24
Enter ".help" for usage hints.
sqlite> .mode column
sqlite> select* from Eenglish;
1           hello     
2           science   
3           laptop    
4           internet  
sqlite> slect * from spanish;[1@e[1@e
1           hola      
2           ciencia   
3           ordenador 
4           internet  
sqlite> select * from translate;
1           1           1         
2           2           2         
3           3           3         
4           4           4         
sqlite> .qiuit
pi:~/public_html/coursework/isc496/assignments/a4> exit

exit

Script done on Mon 25 Sep 2017 02:35:21 PM EDT