/    Sign up×
Community /Pin to ProfileBookmark

Insert Function isn’t working!!

[B]I have some code(below) that the INSERT function wont work. The error message displayed is:[/B][I] “Fatal error</b>: Uncaught exception ‘com_exception’ with message ‘Error [0x8002000e] Invalid number of parameters.”[/I]

Code:
<?

if ($a == 1)
{
echo “<script type=’text/javascript’> n”;
echo “var temp1; n”;
echo “total; n”;
echo “var total = 0; n”;
echo “var x = 0; n”;
echo “for (counter=0;counter<3;counter++){ n”;
echo “x = x + 1; n”;
echo “var temp3 = ‘colid’ + x; n”;
echo “var content=document.getElementsByTagName(temp3) n”;
echo “temp1 = content[0]; n”;
echo “for(c=0;c<content.length;c++) { n”;
echo “var temp4 = 1; n”;

echo “for(d=0;d<content.length;d++){ n”;
echo “if (c == d) {} n”;
echo “else{ n”;
echo “if (content[d].innerHTML == content[c].innerHTML) { n”;
echo “total = total + 1; n”;
echo “} n”;
echo “} n”;
echo “} n”;
echo “} n”;
echo “} n”;

[COLOR=”Red”][B]echo “$rS2 = $db_conn->execute(“INSERT INTO TempData(Col1) VALUES(‘total’)”);n”;[/B][/COLOR]
echo “</script>n”;

}

?>

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@SyCoJan 28.2009 — Well it's hard to say with knowing what happens in the class but I'm guessing 'total' is a numerical value and is probably stored as such in a column type that requires a number. You're passing in the word 'total', not a numeric value so you're getting an error.

total is a JavaScript variable not a PHP one.

Just a comment on your code

[code=php]echo 'foo';
echo '...';
echo 'bar';
[/code]

is avoided by escaping from PHP

?>

foo ... bar

<?

It makes it easier to see where you areespecially when mixing PHP and jS
×

Success!

Help @hewstone999 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...