質問編集履歴
1
コードの変数を編集しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
$userid = $_SESSION['userid'];
|
52
52
|
|
53
|
-
$body = substr($_POST['
|
53
|
+
$body = substr($_POST['content'],0,140);
|
54
54
|
|
55
55
|
|
56
56
|
|
@@ -78,7 +78,7 @@
|
|
78
78
|
|
79
79
|
?>
|
80
80
|
|
81
|
-
<form method='post' action='
|
81
|
+
<form method='post' action='index.php'>
|
82
82
|
|
83
83
|
<p>Your status:</p>
|
84
84
|
|
@@ -152,9 +152,9 @@
|
|
152
152
|
|
153
153
|
function add_post($userid,$body){
|
154
154
|
|
155
|
-
$sql = "insert into posts (
|
155
|
+
$sql = "insert into posts (content,created)
|
156
|
-
|
156
|
+
|
157
|
-
values ($
|
157
|
+
values ($content,now());
|
158
158
|
|
159
159
|
|
160
160
|
|
@@ -170,9 +170,9 @@
|
|
170
170
|
|
171
171
|
|
172
172
|
|
173
|
-
$sql = "select
|
173
|
+
$sql = "select content,created from posts
|
174
|
-
|
174
|
+
|
175
|
-
where
|
175
|
+
where id = '$content' order by created desc";
|
176
176
|
|
177
177
|
$result = mysql_query($sql);
|
178
178
|
|
@@ -180,13 +180,7 @@
|
|
180
180
|
|
181
181
|
while($data = mysql_fetch_object($result)){
|
182
182
|
|
183
|
-
$posts[] = array( '
|
183
|
+
$posts[] = array( 'content' => $cntent);
|
184
|
-
|
185
|
-
'userid' => $userid,
|
186
|
-
|
187
|
-
'body' => $data->body
|
188
|
-
|
189
|
-
);
|
190
184
|
|
191
185
|
}
|
192
186
|
|