ghadacr Posted August 3, 2007 Share Posted August 3, 2007 The below for each is not working as its not inserting the code into the database, i'm not sure what to do help please... <?PHP include 'opendb.php'; ?> <?PHP include 'header.php'; ?> <?php $title = $_GET['title']; $firstname = $_GET['firstname']; $surname = $_GET['surname']; $ChildAdult = $_GET['ChildAdult']; $cost = $_GET['cost']; $notes = $_GET['notes']; $flight = $_GET['flight']; $client = $_GET['client']; foreach ($_GET as $index => $key) { $query = mssql_init ("sp_insertFlightSpaces"); mssql_bind($query, "@FlightID", $flight, SQLVARCHAR); mssql_bind($query, "@ClientDetailID", $client, SQLINT2); mssql_bind($query, "@ChildOrAdult", $data[$index][3], SQLBIT); mssql_bind($query, "@Notes", $data[$index][4], SQLVARCHAR); mssql_bind($query, "@Title", $data[$index][0], SQLVARCHAR); mssql_bind($query, "@FirstName", $data[$index][1], SQLVARCHAR); mssql_bind($query, "@Surname", $data[$index][2], SQLVARCHAR); if (($result = mssql_execute($query)) === false) { die('Could not execute the query query 2(Insert client)'); } ///-------------------------------------------- } //} //} //mssql_bind($query, "@cost", $data[$index][4], SQLVARCHAR); mssql_close() ?> <?PHP include 'footer.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/63166-for-each-help/ Share on other sites More sharing options...
DeadEvil Posted August 3, 2007 Share Posted August 3, 2007 foreach ($_GET as $data) { mssql_bind($query, "@ChildOrAdult", $data['ChildAdult'], SQLBIT); and so on... } Quote Link to comment https://forums.phpfreaks.com/topic/63166-for-each-help/#findComment-314850 Share on other sites More sharing options...
ghadacr Posted August 3, 2007 Author Share Posted August 3, 2007 Thanks for the suggestion, i did the changes and i'm getting the following error: Fatal error: Only variables can be passed by reference in C:\on line 27 Which is this line: mssql_bind($query, "@ChildOrAdult",$data['ChildAdult'],SQLBIT); it does not like this ['ChildAdult'] Quote Link to comment https://forums.phpfreaks.com/topic/63166-for-each-help/#findComment-314855 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.