Jump to content

Archived

This topic is now archived and is closed to further replies.

2wasted

update?

Recommended Posts

lo all,
i have put a vote yes/no on a guestbook that submits with the other info name,email,comment.it works ok,but could i use "update" or something like that so it adds in the database?
this is what i have done...
[!--coloro:#006600--][span style=\"color:#006600\"][!--/coloro--] $name = $_POST["txt_name"];
$len = strlen($name);
if ($len > 0)
{ $email = $_POST["txt_email"];
$comment = $_POST["txt_comment"];
$date = time();
$yvote = $_POST["ybutton"];
$nvote = $_POST["nbutton"];
if ($ybutton == true)
{
$yvote++;
}
else
{
$nvote++;
}
$query = "INSERT INTO guestbook (autoID, name, email, comment, date_auto, yvote, nvote) VALUES (NULL, '$name', '$email', '$comment', '$date', '$yvote', '$nvote')";[!--colorc--][/span][!--/colorc--]
Thx for any help:-)
Charlie

Share this post


Link to post
Share on other sites
What are the issues you are having?

INSERT should be fine to add entries to the database.

Share this post


Link to post
Share on other sites
thx for the reply,what i would like is for the votes to be added up in the database.atm it looks like this in the DB,
Name,email,comment(memo),yvote1,novote 0<<submit 1
Name,email,comment(memo),yvote1,novote 0<<submit 2
i would like..
Name,email,comment(memo),yvote2,novote 0<<submit 2 the yvote adding atm its just telling me what there vote was.
yvote=yes
nvote=no
Thx
Charlie

Share this post


Link to post
Share on other sites
Do you mean you added a vote system to an existing database/code and you need an update
query to get the votes in if a existing user votes.


Share this post


Link to post
Share on other sites
[!--quoteo(post=383104:date=Jun 13 2006, 12:38 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 13 2006, 12:38 AM) [snapback]383104[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Do you mean you added a vote system to an existing database/code and you need an update
query to get the votes in if a existing user votes.
[/quote]
soz for not explaining it properly,but yeah when they vote it goes into the DB but i would like the number to update:-)
Thx
Charlie

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.