Re: Mysqli issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<!-- SNIP -->
> >> Attempting to setup a prepared statement in php that will update a
> >> record in a mysql database using mysqli
> >>
> >> Here is the relevant code:
> >> 	$stmt = mysqli_stmt_init($link);
> >> 	mysqli_stmt_prepare($stmt, "UPDATE purl.schreur (FName, LName,  
> >> email,
> >> phone, record, subscribed, date, IPAddress, Business, Address1, City,
> >> State, Zip, Coffee, Meeting, areaPlans) VALUES
> >> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
> >> 		
> >> 	mysqli_stmt_bind_param($stmt, 'ssssssssssssssssss',
> >> $_POST['txtFName'], $_POST['txtLName'], $_POST['txtEmail'],
> >> $_POST['txtPhone'], $_POST['txturl'], $_POST['record'],
> >> $_POST['subscribed'],$date, $_SERVER['REMOTE_ADDR'],
> >> $_POST['txtBusiness'], $_POST['txtAddress1'], $_POST['txtCity'],
> >> $_POST['txtState'], $_POST['txtZip'], $_POST['rdoCoffee'],
> >> $_POST['rdoTime'], $_POST['areaPlans']) ;//or die(mysqli_error 
> >> ($link));
> >> 	echo "<BR>Dump of stmt:<BR>";

<!-- SNIP -->
> > Then, your statement should be more along the lines of:
> > mysqli_stmt_bind_param($stmt,  
> > 'ssssssssssssssssss','$txtFName','$txtLName','$txtEmail','$txtPhone',' 
> > $txturl','$record','$subscribed',$date,  
> > '$REMOTE_ADDR','$txtBusiness','$txtAddress1','$txtCity','$txtState','$ 
> > txtZip','$rdoCoffee','$rdoTime','$areaPlans') ;
> 

Double DOH here...

I was looking at my MySQL not MySQLi stuff, and there is some differences...  Must be the cold drugs/

'$var' definitely should have been $var since you want the contents, but according to the php site, the prepare is for the query, so my guess is you'll want the query put in the line instead of what looks to be the pieces of the insert?
http://us2.php.net/manual/en/mysqli-stmt.prepare.php

mysqli_stmt_prepare($stmt, 'SELECT District FROM City WHERE Name=?')

Of course, you could do the 
Query="insert into TABLE values($var,$var.....)";
mysqli_stmt_prepare($stmt, $Query);

I'm gonna go drink more cold drugs now...

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux