Click here to Skip to main content
15,891,423 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan25-Feb-17 21:29
mveRichard MacCutchan25-Feb-17 21:29 
GeneralRe: Call to Member function execute() on null... Pin
samflex25-Feb-17 21:37
samflex25-Feb-17 21:37 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan25-Feb-17 21:42
mveRichard MacCutchan25-Feb-17 21:42 
GeneralRe: Call to Member function execute() on null... Pin
samflex25-Feb-17 21:47
samflex25-Feb-17 21:47 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan26-Feb-17 21:06
mveRichard MacCutchan26-Feb-17 21:06 
GeneralRe: Call to Member function execute() on null... Pin
samflex27-Feb-17 0:34
samflex27-Feb-17 0:34 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan27-Feb-17 0:42
mveRichard MacCutchan27-Feb-17 0:42 
GeneralRe: Call to Member function execute() on null... Pin
samflex27-Feb-17 3:22
samflex27-Feb-17 3:22 
Ok thanks for your help.

Hopefully, someone else will be able to help.

Here is my INSERT statement:

PHP
$sql = 'INSERT INTO `disclosures`.`wp_disclosures` ( `employeeID`'
     . ', `sourcename`, `sourceaddress`, `income`,`spousename`,`spouseAddress`,`spouseincome` )'
     . ' VALUES ( ? , ? , ? , ? , ? , ? , ? )';

if( $sth = mysqli_prepare($conn,$sql) ) {
for($i=0; $i<count($last_id); $i++)
{
$sth->execute(array($last_id,
$_POST['sourcename'][$i],
$_POST['sourceaddress'][$i],
$_POST['income'][$i]),
$_POST['spousename'][$i],
$_POST['spouseAddress'][$i],
$_POST['spouseIncome'][$i]);
 }


Just given the way the INSERT statement is written, I am getting the following error:

rning: mysqli_stmt::execute() expects exactly 0 parameters, 4 given in C:\xampp\htdocs\closures\forms\final.php on line 43
Error: No data supplied for parameters in prepared statement


But I believe that I am getting those errors because I could not bind the parameters like I did with the other INSERT statement like this:

PHP
( $sth = mysqli_prepare($conn,$query) ) {
   mysqli_stmt_bind_param($sth,'sss'
      ,$_POST["employeename"]
      ,$_POST["ttitle"]
      ,$_POST["email"]
   );


Notice this line:

sqli_stmt_bind_param($sth,'sss'

I need to find a way to add something like this:

sqli_stmt_bind_param($sth,'ssssssss' to my INSERT statement to get resolve the problem.

Just can't figure out how to integrate that with the mysqli_prepare(...) statement or the $sth->execute(array($last_id,... array statement.
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan27-Feb-17 3:33
mveRichard MacCutchan27-Feb-17 3:33 
GeneralRe: Call to Member function execute() on null... Pin
samflex27-Feb-17 4:04
samflex27-Feb-17 4:04 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan27-Feb-17 4:21
mveRichard MacCutchan27-Feb-17 4:21 
GeneralRe: Call to Member function execute() on null... Pin
samflex27-Feb-17 4:31
samflex27-Feb-17 4:31 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan27-Feb-17 4:38
mveRichard MacCutchan27-Feb-17 4:38 
GeneralRe: Call to Member function execute() on null... Pin
samflex27-Feb-17 5:35
samflex27-Feb-17 5:35 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan27-Feb-17 6:49
mveRichard MacCutchan27-Feb-17 6:49 
GeneralRe: Call to Member function execute() on null... Pin
Richard Deeming27-Feb-17 7:56
mveRichard Deeming27-Feb-17 7:56 
GeneralRe: Call to Member function execute() on null... Pin
samflex27-Feb-17 8:09
samflex27-Feb-17 8:09 
GeneralRe: Call to Member function execute() on null... Pin
samflex27-Feb-17 11:44
samflex27-Feb-17 11:44 
GeneralRe: Call to Member function execute() on null... Pin
Richard MacCutchan27-Feb-17 21:28
mveRichard MacCutchan27-Feb-17 21:28 
GeneralRe: Call to Member function execute() on null... Pin
Richard Deeming28-Feb-17 1:09
mveRichard Deeming28-Feb-17 1:09 
GeneralRe: Call to Member function execute() on null... Pin
samflex28-Feb-17 1:23
samflex28-Feb-17 1:23 
GeneralRe: Call to Member function execute() on null... Pin
Richard Deeming28-Feb-17 1:40
mveRichard Deeming28-Feb-17 1:40 
GeneralRe: Call to Member function execute() on null... Pin
samflex28-Feb-17 3:30
samflex28-Feb-17 3:30 
GeneralRe: Call to Member function execute() on null... Pin
Richard Deeming28-Feb-17 3:39
mveRichard Deeming28-Feb-17 3:39 
GeneralRe: Call to Member function execute() on null... Pin
samflex28-Feb-17 4:00
samflex28-Feb-17 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.