yddib Posted March 23, 2008 Share Posted March 23, 2008 I've been trying for a week to best solve a project for college. Could someone please guide me in the right direction. I have to use MS Access and because of this it is hard to find code online or in books. I have to have a login page that depending on the users job level, (manager, admin etc) brings you to different pages. I know that this involves passing form variables and also if statements but I can't get it working. Quote Link to comment https://forums.phpfreaks.com/topic/97501-project-please-help/ Share on other sites More sharing options...
eddierosenthal Posted March 23, 2008 Share Posted March 23, 2008 have you been able to connect to the access database? what does the javascript select statement look like and what does the form look like and what php have you used? ( code please). Quote Link to comment https://forums.phpfreaks.com/topic/97501-project-please-help/#findComment-498891 Share on other sites More sharing options...
papaface Posted March 23, 2008 Share Posted March 23, 2008 MS Access has nothing to do with PHP! Quote Link to comment https://forums.phpfreaks.com/topic/97501-project-please-help/#findComment-498895 Share on other sites More sharing options...
yddib Posted March 23, 2008 Author Share Posted March 23, 2008 I can connect to the Access Database: <?php //create an instance of the ADO connection object $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); //define connection string, specify database driver $connStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=c:folder\emp.mdb"; //Open the connection to the database $conn->open($connStr); ?> The form is a regular html form: <form name="myform" action="check.php" method="post"> Username: <input type="text"> etc I am confused as to how to get the submit working to each different user. I know Access is not usually used with php. As I explained it is a requirement for my project. I KNOW it would be easier to use MySQL but I can't. Quote Link to comment https://forums.phpfreaks.com/topic/97501-project-please-help/#findComment-498898 Share on other sites More sharing options...
MadTechie Posted March 23, 2008 Share Posted March 23, 2008 Heres a quick example that may help (untested but i think its sound) <?php //create an instance of the ADO connection object $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); //define connection string, specify database driver $rs= "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=c:folder\emp.mdb"; //updated //Open the connection to the database // $conn->open($connStr);//removed $conn->ConnectionString = $connStr ; //updated $conn->Open(); # Sql table $table = "my_sql_table"; $sql = "SELECT * FROM $table"; $rs->Open($sql, $conn); $assoc_array = array(); $index = 0; # Iterate through our result while (!$rs->EOF) { for( $x = 0; $x < $rs->Fields->Count; $x++ ) { $assoc_array[ $index ][ $rs->Fields[$x]->Name ] = $rs->Fields[$x]->Value; } # Move cursor to next row in recordset $rs->MoveNext(); $index++; } # Print the array echo "<pre>"; print_r($assoc_array); echo "</pre>"; # Close the connection and the recordset $rs->Close(); $conn->Close(); EDIT: made a few updates Quote Link to comment https://forums.phpfreaks.com/topic/97501-project-please-help/#findComment-498901 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.