It could be that your $new_poll_id variable that you use in your SELECT COUNT statement isn't set.
Main Topics
Browse All Topicshi
i am getting error while try to use this method i dont know how can i fix it i rather replace it with something else please advice
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
if ($mode == "savepoll")
{
$result = mysql_query("SELECT COUNT(*) AS num FROM tapps_polls WHERE poll_id=$new_poll_id");
$o = mysql_fetch_object($result
if ($o->num != 0)
{
$result = mysql_query("UPDATE tapps_polls SET poll_id=$new_poll_id, title='$title', valid_until='$valid_until'
} else
{
$result = mysql_query("INSERT INTO tapps_polls (poll_id,title,valid_until
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
this is what i am getting when i done the error_reporting(E_ALL);
Notice: Undefined variable: new_poll_id in C:\xampp\htdocs\sep\manage
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\sep\manage
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 '' at line 1
Notice: Trying to get property of non-object in C:\xampp\htdocs\sep\manage
Notice: Undefined variable: new_poll_id in C:\xampp\htdocs\sep\manage
Notice: Undefined variable: title in C:\xampp\htdocs\sep\manage
Notice: Undefined variable: valid_until in C:\xampp\htdocs\sep\manage
Notice: Undefined variable: max_answers in C:\xampp\htdocs\sep\manage
Notice: Undefined variable: description in C:\xampp\htdocs\sep\manage
Notice: Undefined variable: enabled in C:\xampp\htdocs\sep\manage
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 ' '', '', , '', '')' at line 1
thats the poll table structure
CREATE TABLE IF NOT EXISTS `tapps_polls` (
`poll_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE latin1_german2_ci NOT NULL,
`valid_until` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`max_answers` tinyint(4) NOT NULL DEFAULT '1',
`description` varchar(255) COLLATE latin1_german2_ci NOT NULL,
`enabled` enum('N','Y') COLLATE latin1_german2_ci NOT NULL DEFAULT 'N',
PRIMARY KEY (`poll_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci AUTO_INCREMENT=92 ;
hi
it turns the problem with the register_globals setting once i put the following while(list($k,$v)=each($_P
$$k=$v; //Yes, that's two dollar signs
} codes at the top of the page everything is fixed now
http://forums.devarticles.
his post made me think about the fact that some people (on shared hosting, for example) don't have the ability to modify their register_globals setting. And I don't believe that's one you can modify at runtime. A quick way around it if you've got to do a quick conversion is to stick the following at the top of your code:
PHP Code:
while(list($k,$v)=each($_P
$$k=$v; //Yes, that's two dollar signs
}
This loops through the $_POST array and, for each key in the array, sets a variable with the name of that key to the associated value, effectively doing what turning register_globals on would do for you.
I personally recommend coding in such a way that you don't need this trick, scoping your variables appropriately for the sake of readability, but if you're in a jam and have to get this up but can't change your register_globals settings, this might be a workable temporary fix.
Business Accounts
Answer for Membership
by: mattibuttPosted on 2009-11-05 at 09:30:00ID: 25751812
when i done mysqlerror echo next to the each query ii am getting the following response
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 '' at line 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' '', '', , '', '')' at line 1