473,385 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Fatal error: Unsupported operand types

2
I am making a simple vote system with yes/no radio buttons and a submit button. On submit it sends users choice to a php file - to be increased by one, related to users input. First it fetches the previous values from database and increases them by one.Second, it puts increased value back into database table.The problem is that my PLUS sign cant be recognized.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $con = mysql_connect("localhost","pinz","password");
  3. if (!$con)
  4.   {
  5.   die('Could not connect: ' . mysql_error());
  6.   }
  7.  
  8. mysql_select_db("pinz_baza", $con);
  9.  
  10. $votey = mysql_query("SELECT VoteYes FROM Votes");
  11. $voten = mysql_query("SELECT VoteNo FROM Votes");
  12.  
  13. $resulty = mysql_fetch_array($votey);
  14. $resultn = mysql_fetch_array($voten);
  15. $resform = $_POST['vote'];
  16.  
  17. if ($resform == 'yes') 
  18.     {
  19.     $resultyn = $resulty + 1; /*error is shown here*/
  20.     mysql_query("UPDATE Votes SET VoteYes = '$resultyn'
  21.     WHERE VoteYes = '$resulty'");
  22.     echo "added one YES vote";
  23.     }
  24. else {
  25.     $resultnn = $resultn + 1; /*and here*/
  26.     mysql_query("UPDATE Votes SET VoteYes = '$resultnn'
  27.     WHERE VoteNo = '$resultn'");
  28.     echo "added one NO vote";
  29.     }
  30.  
  31. mysql_close($con);
  32. ?>
Help me plzzz
Dec 10 '10 #1
2 3056
Xicer
13
I am fairly new to php but you could try this:
Expand|Select|Wrap|Line Numbers
  1. $resultyn = $resulty ++; 
and the same for the other part.

Just my 2 cents
Dec 10 '10 #2
pinz
2
nope doesnt work

thx for attention anyways...

Still need help plz
Dec 10 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: DJ Craig | last post by:
I keep getting this error: Fatal error: Unsupported operand types in /usr/local/etc/httpd/htdocs/djtricities/kat/bpmchart/chart.php on line 58 I've looked for hours for some type of error, and...
3
by: Martin Koekenberg | last post by:
Hello, Ik get the following error when I install a new Python software package such as Zope or PIL. This is what I get whem I 'make' Zope : running build_ext Traceback (most recent call...
3
by: Rakesh | last post by:
In my Python code fragment, I want to write a code fragment such that the minimum element of a tuple is subtracted from all the elements of a given tuple. When I execute the following python...
3
by: yaffa | last post by:
hey folks i get this error: Python interpreter error: unsupported operand type(s) for |: when i run this line of code: for incident in bs('tr', {'bgcolor' : '#eeeeee'} | {'bgcolor' :...
3
by: tanusreesen | last post by:
Hi All, I am completely new to python programming language.I was trying to write a program on class.But I am getting this error.Can someone please help me to solve the error I am facing.I...
1
by: Florian Lindner | last post by:
Hello, I get the exception above when trying to use a float as radix and exponent, e.g.: Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: unsupported operand type(s)...
8
by: Gilbert Fine | last post by:
This is a very strange exception raised from somewhere in our program. I have no idea how this happen. And don't know how to reproduce. It just occurs from time to time. Can anyone give me some...
2
by: Jordan Harry | last post by:
I'm trying to write a simple program to calculate permutations. I created a file called "mod.py" and put the following in it: def factorial(n): a = n b = n while a>0 and b>1: n = (n)*(b-1)...
1
by: flapjacks | last post by:
line1 = ((0.0, -1.0), (1.0, 1.0), (2.0, 3.0), (3.0, 5.0), (4.0, 7.0), (5.0, 9.0), (6.0, 11.0), (7.0, 13.0), (8.0, 15.0), (9.0, 17.0)) line2 = ((0.0, 2.0), (1.0, 1.0), (2.0, 0.0), (3.0, -1.0), (4.0,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.