Re: [PHP] Re: Been staring at the code for too long...

2009-01-09 Thread Kyle Terry
On Fri, Jan 9, 2009 at 11:05 AM, Nathan Rixham  wrote:

> Jason Pruim wrote:
>
>>mysqli_stmt_prepare($stmt, "UPDATE database.table (
>>
>
> UPDATE database.table SET (
>
> think that should fix it
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Unless his database is named database and his table is named table. ;)

-- 
Kyle Terry | www.kyleterry.com


[PHP] Re: Been staring at the code for too long...

2009-01-09 Thread Nathan Rixham

Jason Pruim wrote:

mysqli_stmt_prepare($stmt, "UPDATE database.table (


UPDATE database.table SET (

think that should fix it

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



[PHP] Re: Been staring at the code for too long...

2009-01-09 Thread Jay Moore

Jason Pruim wrote:
Okay... So I know this is a stupid question... But I've been staring at 
my code for far too long and now it's still not working so I thought I 
would show it to all of you and see if you can tell me where I'm being 
stupid :)


this is dbmysqliconnect.php:
function dbmysqliconnect($server, $username, $password, 
$database, $link) {

$link = mysqli_init();
mysqli_real_connect($link, $server, $username, 
$password, $database) or die('could not connect: '.mysqli_connect_error());



if (mysqli_connect_errno($link)) {
printf("Connect failed: %s\n", 
mysqli_connect_error($link));

exit();
}

return $link;
}
?>

this is a snipet of my index.php file:

$link = dbmysqliconnect($server, $username, $password, 
$database, $link);





//Do NOT insert or update sales rep database through this 
method... Only included to be supplied to the notify_email function. JP

$salesRepID = $_POST['salesRepID'];

$stmt = mysqli_stmt_init($link);

//Create the statement

mysqli_stmt_prepare($stmt, "UPDATE database.table (
FName, LName,  email, 
phone, url, record,
subscribed, date,  
IPAddress,  Business,
Address1,  City,  
State,  Zip,
Coffee,  Meeting,  
areaPlans)
VALUES 
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");


// Error checking. JP

echo "Print of post:";
print_R($_POST);
echo "dump of the statement:";
var_dump($stmt);



mysqli_stmt_bind_param($stmt, 's',
   $_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)); 

The error that I am getting is:

Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: 
invalid object or resource mysqli_stmt in 
/public_html/purl/purlprocess.php on line 67
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 '( FName, 
LName, email, phone, url, recor' at line 1


Am I just going crazy or is there something really wrong?

Okay.. I'm done... First stupid question of the year... Only 3,349,587 
more to go for the year! :P




--
Jason Pruim
japr...@raoset.com
616.399.2355






Maybe try enclosing your field names in backticks?

Jay

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