Jump to content

Project!! Please help!!


yddib

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/97501-project-please-help/
Share on other sites

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.

 

Link to comment
https://forums.phpfreaks.com/topic/97501-project-please-help/#findComment-498898
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/97501-project-please-help/#findComment-498901
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.