Been staring at the code for too long...

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

 



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:
<?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:

<?PHP
        include("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 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 "<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 67

        echo "<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@xxxxxxxxxx
616.399.2355




[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