Insert Function isn't working!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hewstone
Forum Newbie
Posts: 14
Joined: Fri Nov 14, 2008 10:57 am

Insert Function isn't working!!

Post by hewstone »

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

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";


echo "$rS2 = $db_conn->execute(\"INSERT INTO TempData(Col1) VALUES('total')\");\n";
echo "</script>\n";

}

?>
tanmay
Forum Newbie
Posts: 12
Joined: Mon Jan 19, 2009 9:51 am

Re: Insert Function isn't working!!

Post by tanmay »

if the code you've given is same code as you are writing then you've not declared "total" variable(line 2 from <script>),counter variable(in for loop).

and for function, first check the number of arguments in function definition and fn calling stmt. and if that is ok,take one variable for query and pass that variable in function calling.i think that should work.
Post Reply