2wasted Posted June 12, 2006 Share Posted June 12, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/11819-update/ Share on other sites More sharing options...
poirot Posted June 13, 2006 Share Posted June 13, 2006 What are the issues you are having?INSERT should be fine to add entries to the database. Quote Link to comment https://forums.phpfreaks.com/topic/11819-update/#findComment-44808 Share on other sites More sharing options...
2wasted Posted June 13, 2006 Author Share Posted June 13, 2006 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 1Name,email,comment(memo),yvote1,novote 0<<submit 2i would like..Name,email,comment(memo),yvote2,novote 0<<submit 2 the yvote adding atm its just telling me what there vote was.yvote=yesnvote=noThxCharlie Quote Link to comment https://forums.phpfreaks.com/topic/11819-update/#findComment-44814 Share on other sites More sharing options...
redarrow Posted June 13, 2006 Share Posted June 13, 2006 Do you mean you added a vote system to an existing database/code and you need an updatequery to get the votes in if a existing user votes. Quote Link to comment https://forums.phpfreaks.com/topic/11819-update/#findComment-44861 Share on other sites More sharing options...
2wasted Posted June 13, 2006 Author Share Posted June 13, 2006 [!--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 updatequery 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:-)ThxCharlie Quote Link to comment https://forums.phpfreaks.com/topic/11819-update/#findComment-44988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.