I'm trying to a create a register page that will connect to my database. login is the data source, and account is the database. I'm having trouble with the odbc_exec function, I'm a beginner in php and I can't get it to work, google isn't helping much either.
$dns="192.168.1.115";
$user="sa";
$pass="password";
$connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=192.168.1.115;Database=account;", "sa", "password");
$select_db = odbc_exec($connect, "login");
with that code I get this error:
Notice: Undefined variable: connect in C:\php\www\register.php on line 12
Warning: odbc_exec() expects parameter 1 to be resource, null given in C:\php\www\register.php on line 12
Then I changed it to this:
$select_db = odbc_exec(login, "account");
and I get a new error:
Warning: odbc_exec() expects parameter 1 to be resource, string given in C:\php\www\register.php on line 12
I think the second parameter is working, but I don't know what to put in the first. I'm guessing its the dsn, but I'm not sure.
I don't know what it means to expect a resource, do I have to remove the quotes or use another bracket? What values does odbc_exec use? I can't find any of this on google. Help...