Re: Been staring at the code for too long...
| From: | Jay Moore | Date: | Fri, 09 Jan 2009 19:03:32 +0000 |
| Subject: | Re: Been staring at the code for too long... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285885@lists.php.net to get a copy of this message | ||
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: <?phpMaybe try enclosing your field names in backticks? Jayfunction 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: <?PHPinclude("php.ini.php"); include("defaults.php"); include("dbmysqliconnect.php"); include("notify_email.php"); include("send_email.php");$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 statementmysqli_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. JPecho "<BR>Print of post:<BR>"; print_R($_POST); echo "<BR>dump of the statement:<BR>"; var_dump($stmt);mysqli_stmt_bind_param($stmt, 'sssssssssssssssss', $_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)); <--------LINE 67echo "<BR>Dump of stmt:<BR>"; var_dump($stmt); //Add the record mysqli_stmt_execute($stmt) or die(mysqli_error($link));printf("Error: %d.\n", mysqli_stmt_error($stmt)); printf("%d Row Inserted.\n", mysqli_stmt_affected_rows($stmt)); $check = mysqli_stmt_error($stmt); echo "<BR>$checkdate<BR>";notify_email($Record, $salesRepID);?> 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 japruim@raoset.com 616.399.2355