dntel
11-22-2007, 08:25 AM
basically im making a PHP login script for my coursework, but i need to change this:
THIScount = mysql_num_rows($sSql);
Into ODBC format, seeing as i am connecting to an Acess Database not a MySQL one, any ideas?
and as an afterthought if you could check i have coded this correctly id be very greatful :)
<?php
//=====================================//
// creates a new Common-Object-Model (COM) connection object
$adoCon = new COM("ADODB.Connection");
// the path to the folder holding this PHP script
$sHere = dirname(__FILE__);
// Access 2003 only
// opens the connection using a standard Access connection string
$adoCon->Open(
"Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=$sHere/UserDetails.mdb");
$var = $_POST['username'];
// USERNAME VARIABLE
$vartwo = md5($_POST['password']);
// PASSWORD VARIABLE//
CONNECT TO DB$adoCon = new COM("ADODB.Connection");
$sHere = dirname(__FILE__);
$adoCon->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$sHere/UserDetails.mdb");
//// COUNT QUERY
$sSQL= "SELECT * FROM tblUsers WHERE `userSurname`='$sUserSurname', `userForename`='$sUserForename'";
//HERE YOU WANT TO COUNT THE RESULTS
THIScount = mysql_num_rows($sSql);
if($count < '1'){echo "Error, user name or password inccorect";}else{echo "User authenticated. Welcome!";}
?>
THIScount = mysql_num_rows($sSql);
Into ODBC format, seeing as i am connecting to an Acess Database not a MySQL one, any ideas?
and as an afterthought if you could check i have coded this correctly id be very greatful :)
<?php
//=====================================//
// creates a new Common-Object-Model (COM) connection object
$adoCon = new COM("ADODB.Connection");
// the path to the folder holding this PHP script
$sHere = dirname(__FILE__);
// Access 2003 only
// opens the connection using a standard Access connection string
$adoCon->Open(
"Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=$sHere/UserDetails.mdb");
$var = $_POST['username'];
// USERNAME VARIABLE
$vartwo = md5($_POST['password']);
// PASSWORD VARIABLE//
CONNECT TO DB$adoCon = new COM("ADODB.Connection");
$sHere = dirname(__FILE__);
$adoCon->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$sHere/UserDetails.mdb");
//// COUNT QUERY
$sSQL= "SELECT * FROM tblUsers WHERE `userSurname`='$sUserSurname', `userForename`='$sUserForename'";
//HERE YOU WANT TO COUNT THE RESULTS
THIScount = mysql_num_rows($sSql);
if($count < '1'){echo "Error, user name or password inccorect";}else{echo "User authenticated. Welcome!";}
?>