daredavil07
Addict
- Joined
- Aug 24, 2018
- Posts
- 63
- Reaction
- 17
- Points
- 83
Hello po mga bossing, may ginagawa po akong parang feedback/comment system para po sa different topic na e-po-post. Gamit ang tbl1, nakakapag-update po ako ng walang problema. Yung kailangan kulang pong gawin e-insert din po pag-submit ang laman ng $1_id, $name1, $comments1, $com_timestamp1 ni tbl1 sa $1a_id, $name2, $com_timestamp2 ni tbl2, para dun napo yung mag increment at repository ng mga comments with respect sa topic 1_id. Anong action query po pwede kung gawin para mapapasok ko din kasama ang 1_id?
Tables:
main.php
details.php
Salamat po ng marami!
Tables:
Code:
DB pollsys
CREATE TABLE tbl1 (
1_id int(5), PRI
topic varchar(50),
name1 varchar(30),
comments1 text,
com_timestamp1 datetime,
);
Code:
DB pollsys
CREATE TABLE tbl2 (
2_id int(5), PRI
1a_id int(5)
name2 varchar(30),
comments2 text,
com_timestamp2 datetime,
);
main.php
HTML:
<a href = "details.php?1_id=<?php echo $row['1_id']; ?>" >Open</a>
details.php
PHP:
<?php
include("conn.php");
if (isset($_POST['submit']))
{
if (is_numeric($_POST['1_id']))
{
$name1 = mysqli_real_escape_string($conn, $_POST['name1']);
$comments1 = mysqli_real_escape_string($conn, $_POST['comments1']);
$com_timestamp1 = date("Y-m-d H:i:s");
if ($comments == '' )
{
renderForm($comments, $error);
}
else
{
mysqli_query($conn, "UPDATE db.tbl1 SET name1='$name1', comments1='$comments1', com_timestamp1='$com_timestamp1' WHERE 1_id='".$_POST['1_id']."'");
{
echo '<script>';
echo 'alert("Post Updated!");';
echo '</script>';
}
?>
Salamat po ng marami!