-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions
More file actions
48 lines (35 loc) · 1.31 KB
/
functions
File metadata and controls
48 lines (35 loc) · 1.31 KB
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
Én valahogy így csinálnám meg. Nem mondom biztosra, hogy működik, mert nem teszteltem le.
<?php
if(isset($_GET['p'])) $edit_slug = $_GET['p'];
if(!empty($edit_slug)) $this->get_post($edit_slug);
else die ("Sorry, this functions is not working!");
function get_post($edit_slug)
{
global $con;
$sql = "SELECT * FROM posts WHERE post_slug = ?";
$stmt = mysqli_stmt_init($con);
$stmt = $this->query();
mysqli_stmt_bind_param($stmt, "s", $edit_slug);
$result = mysqli_stmt_get_result($stmt);
while($row = mysqli_fetch_assoc($result))
{
$post_id = $row['post_id'];
$post_category_id = $row['post_category_id'];
$post_status_id = $row['post_status_id'];
$post_user_id = $row['post_user_id'];
$post_title = $row['post_title'];
$post_date = $row['post_date'];
$post_image = $row['post_image'];
$post_content = $row['post_content'];
$post_tags = $row['post_tags'];
$post_comment_count = $row['post_comment_count'];
$post_slug = $row['post_slug'];
}
mysqli_stmt_close($stmt);
} // function
function query($con, $sql)
{
$stmt = mysqli_stmt_init($con);
if(!mysqli_stmt_prepare($stmt, $sql)) { die('QUERY FAILED: ' . mysqli_error($con)); }
return $stmt;
}