-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql_starting.html
60 lines (45 loc) · 1.97 KB
/
sql_starting.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>SQL Setup and Usage</title>
<meta charset="UTF-8">
</head>
<body>
<h1>SQL</h1>
<!-- About SQL -->
<h2>Setup</h2>
<p>Manage your database with <a href="http://localhost/phpmyadmin/">phpMyAdmin running on Localhost</a></p>
<h2>Usage</h2>
<h3>CodeIgniter Tutorial - News section</h3>
<h3>Make a New Database</h3>
<p>From the CodeIgniter tutorial number 2, News section, from User guide</p>
<p>In phpMyAdmin click new, then in the Create database, Database name field type dougtest1. Push Create button.<p>
<p>This made a new database named dougtest1.</p>
<h3>Make a New Table</h3>
<p>From CodeIgniter Tutorial - News section -- it asks you to make this database:</p>
<pre>
CREATE TABLE news (
id int(11) NOT NULL AUTO_INCREMENT,
title varchar(128) NOT NULL,
slug varchar(128) NOT NULL,
text text NOT NULL,
PRIMARY KEY (id),
KEY slug (slug)
);
</pre>
<p>Now you will use the above SQL code to create a table called news. In phpMyAdmin, select dougtest1, the click the SQL tab.
Copy this text and paste it into the SQL query text window. Press the Go button.
</p>
<h3>Insert Data Into the Table</h3>
<p>Insert items into news table. Under database dougtest1, Structure tab, click on the Table news.
You should see the column names. Select the Insert tab.
Click Insert tab. Under the Value column, Enter id of 1, title of "Hello World One" (don't include quotes), slug hello_1, and test of "Hi World!" (again no quotes.)
Press the Go button.
</p>
<p>You can go back to the Browse tab and see the data in your table. Go back to the Insert tab and add more rows.
</p>
<p>Now go to the <a href="testci/index.php/news">News section</a> tutorial page and view your articles</p>
<h3>Use Form Example</h3>
<p>The final version of the tutorial has a way of entering data through a form. <a href="testci/index.php/news/create">Create news article with form</a></p>
</body>
</html>