PDA

View Full Version : Setting up my database


mehole8338
12-26-2006, 08:21 AM
Hi
i've got this school project and a series of tasks to complete for it, one of which is a website that i decided to create and i am including a membership signup form on it. i have made the form, it works fine and sends to my e-mail as well, but i thought to myself that maybe i could not only have the form send to an email, but also to add the member to the database when the user submits, and since i have some databases available on my server i thought i'd use them so i set one up...so i did :)

Trouble is, I don't know how to use the database that i have created in access on my server. do you set it up in access? if so, how?

I've never done something like this before (obviously :P) but i am trying to develop my skills in web design and programming as i may need to do this sort of thing in the not-too-distant-future (and get a good grade in this project :))

Many thanks! :D
Mike

Vege
12-26-2006, 12:01 PM
What server side language are you using?
What server enviroment (Linux/Windows)?

mehole8338
12-26-2006, 12:55 PM
What server side language are you using?
PHP (thanks for sorting out that problem i had btw :))
What server enviroment (Linux/Windows)?
Windows

Paul
12-27-2006, 11:13 AM
Do you have physical access to the machine and can log into the windows desktop? When yoy say you are running windows is it windows XP (home or Pro) or is it Windows 2000 or 2003? And finally what version of access are you running?

I am not too familiar with running access as a web database, I personally prefer mySQL, but I know if you have physical access to the machine you can create tables in the access GUI. Not sure if you were able to do this yet.

Then you can use a code like this taken from:

http://aspn.activestate.com/ASPN/Cookbook/PHP/Recipe/163447


<?php

// Two versions of Microsoft Office. Choose one.
//$db = 'C:\\Program Files\\Microsoft Office\\Office\\Samples\\Northwind.mdb';
$db = 'C:\\Program Files\\Microsoft Office\\Office10\\Samples\\Northwind.mdb';

$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');

// Two ways to connect. Choose one.
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.');
//$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or exit('Cannot open with driver.');

$sql = 'SELECT ProductName, QuantityPerUnit, UnitPrice
FROM Products
ORDER BY ProductName';
$rs = $conn->Execute($sql);

?>

<table>
<tr>
<th>Product Name</th>
<th>Quantity Per Unit</th>
<th>Unit Price</th>
</tr>
<?php while (!$rs->EOF) { ?>
<tr>
<td><?php echo $rs->Fields['ProductName']->Value ?></td>
<td><?php echo $rs->Fields['QuantityPerUnit']->Value ?></td>
<td><?php echo $rs->Fields['UnitPrice']->Value ?></td>
</tr>
<?php $rs->MoveNext() ?>
<?php } ?>
</table>

<?php

$rs->Close();
$conn->Close();

$rs = null;
$conn = null;

?>

mehole8338
12-27-2006, 11:33 AM
Do you have physical access to the machine and can log into the windows desktop? When yoy say you are running windows is it windows XP (home or Pro) or is it Windows 2000 or 2003? And finally what version of access are you running?


sorry, i should have been more specific, i have windows XP home edition and access 2000. and i do have access to the machine and desktop.

I will try out that code and get back to you. Thanks :)

RogerRamjet
01-09-2007, 12:48 PM
Forget access, never very good for web and now redundant.

Go get SQL Server 2005 Express from microsoft (http://msdn2.microsoft.com/en-us/sql/aa336346.aspx) and invest your energy and efforts in learning that. Far more usefull both now and in the future.

Indeed, if you get the whole visual studio 2005 express you will find that it is very quick to develop a simple system such as you want - about 2 hours from scratch. The tutorial videos will take you through it step by step. You will then have a skill that is worth something in the job market today.