# Double post!

**URL:** <https://forum.kirupa.com/t/double-post/265006>\
**Category:** programming\
**Created:** [July 2, 2008, 9:49pm UTC](https://forum.kirupa.com/t/double-post/265006 "2008-07-02T21:49:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valerij](https://avatars.discourse-cdn.com/v4/letter/v/e68b1a/32.png) [@Valerij](https://forum.kirupa.com/u/Valerij)\
**Post date:** [July 2, 2008, 9:49pm UTC](https://forum.kirupa.com/t/double-post/265006/1 "2008-07-02T21:49:29Z")

</div>

Hi, I have an annoying problem with my guestbok; when you post there for the FIRST time, only then, (also if you deleted your cookies…:P) You get a double post, the one is the actual post, the second one is just blank.

Is there any way you can fix this…:S? Heres my code;

```php
echo "<center><br/><b>Sign $username's guestbook</b><br/>
<form action=\"member.php?sign=$username&from=".$_SESSION["username"]."\" method='POST'>
<textarea name='message' rows='5' cols='30' align='left'>Your message</textarea><br/>
<input type='submit' value='Update' name='submit'>

```

This is the code that is showing the sign guestbook box.

And this is the function.

```php

if(isset($_GET["sign"]))
{ // Sign the guestbook
require_once("functions/DbConnector.php");
$username = $_GET["sign"];
$from = $_GET["from"];
$message = $_POST["message"];
$time = date("j. F Y, G:i");
$db = new DbConnector();
$db->connect();
$query = "INSERT INTO guestbook(username,postedby,post,time) VALUES('$username','$from','$message','$time')";
$db->query($query);
echo "Your message has been posted";

```

Hope this is fixable… 🙂  
Thank you.

---

<div class="post-metadata">

**Author:** ![iNeed\_Help](https://avatars.discourse-cdn.com/v4/letter/i/49beb7/32.png) [@iNeed\_Help](https://forum.kirupa.com/u/iNeed_Help)\
**Post date:** [July 3, 2008, 9:40am UTC](https://forum.kirupa.com/t/double-post/265006/2 "2008-07-03T09:40:33Z")

</div>

Try adding LIMIT 1 to the end of your query, like this:

```php

$query = "INSERT INTO guestbook(username,postedby,post,time) VALUES('$username','$from','$message','$time') LIMIT 1";

```

---

<div class="post-metadata">

**Author:** ![Valerij](https://avatars.discourse-cdn.com/v4/letter/v/e68b1a/32.png) [@Valerij](https://forum.kirupa.com/u/Valerij)\
**Post date:** [July 3, 2008, 1:17pm UTC](https://forum.kirupa.com/t/double-post/265006/3 "2008-07-03T13:17:33Z")

</div>

Got an error;  
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 1’ at line 1
