So like I'm trying to make a register page for Gunz and I haven't made one in so long so i'm coming across odbc errors and what not.
Anyways I made a script for retrieving user names etc for ranking and it worked perfectly..
I'm trying to insert data into mssql but it's not working so good for me.
Heres the script:
Code:<?php //connect to a DSN "myDSN" $host = "COMPUTER2\SQLEXPRESS"; $user = "sa"; $pass = "jimmydont"; $dbname = "GunzDB"; $conn = odbc_connect("Driver={SQL Server};Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect the MSSQL server."); if ($conn) { //the SQL statement that will query the database $query = "INSERT INTO Login(UserID,Password) VALUES ('jimmy','dontcry')"; //perform the query $result=odbc_exec($conn, $query); } ?> <html> <body> <form action = "#" method = "post"/> Username<input type = "text" name = "username"/> Password<input type = "password" name = "password"/> <input type = "submit" name = "Login" value = "Login"/> </form> </body> </html>
I eject this and all it says is
:
I'm clearly not inserting NULLS as I definitively filled in information to enter.. Yes I tried $_POST['username'] I tried so many different combinations of going about this..Code:Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'AID', table 'GunzDB.dbo.Login'; column does not allow nulls. INSERT fails., SQL state 23000 in SQLExecDirect in C:\xampp\htdocs\retrievedata.php on line 16
I'm on Xamp 1.7.1 , mssql is allowed.


Reply With Quote


