/    Sign up×
Community /Pin to ProfileBookmark

Javascript Database

I have to set up a database but all I have to work with is MS Works (doh!)

I have written JS that runs a form to capture the information, just not sure how to isolate and append it to a file (this is all happening on a standalone computer and DB does not deal with personal information so security is not a big issue).

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@DarkRedSpiralAug 21.2005 — BritMiss

Sadly JS doesn't have a method to write to files ?

It can do many wonderful things but sadly not that. You do have a variety of

avenues that you could explore.

Java is an option.. however i dont know what you skill set is and it can be a hmmmmm difficult language to get to grips with.

Alternately you could set up you PC with a web server and MySql. It is free and

you could store your data in a MySql Database. There is a free port for all the windows platforms that will run on just about any modern hardware.

You can get it from http://www.firepages.com.au/phpdev5.htm

Once you have this installed you PC becomes your webserver and you can write PHP based CGI scripts to accept the POSTs from your webpages...

You will have to spend a bit of time learning PHP and SQL but it is a lot easier than setting up JAVA to write to a database!

Hope this helps

Steve
Copy linkTweet thisAlerts:
@BritMissauthorAug 22.2005 — Actually, I am trying to figure out MySQL as the alternative. But I have this problem... which doesn't seem to be covered in any of the documentation, and the MySQL native forums were closed following several attacks. But if you can help me, great. How do I connect to the server? (I have tried both MySQL and DBDesigner 4) I always get asked for username and password but have no idea how to set up a MySQL server with U/N and P/W on my PC.

As far as writing to a file, I have found a trick that lets me save the webpage which includes the script, and append text to the page "on the fly" so am hoping to cobble up a work-around.

I have some background in AWK scripting, and about 20 years ago was regularly using a UNIX system but these days my understanding of computers is pretty basic.
Copy linkTweet thisAlerts:
@DarkRedSpiralAug 22.2005 — Myscha

Well the connection method depends on the software you are going to use to attach to the MySql Database. You can go witha straight ODBC connection from something like VB or Delphi. Or you could go for a Webserver/PHP/MySql solution

The link in the message below will take you to a download of an Apache/MySql/PHP cofigured package that puts all 3 of the products

on your PC it needs very little configuration to get running locally and

allows you to

a) Administer/Create/Authorise your MYSQL databases

and

b) Develope the PHP that will act as your CGI processor for the POSTs from your HTML/JS pages.

Once installed your browser will start and if all goes well you will be taken

to a page on your browser which has a START HERE link.. This will take you to the control panel for your MySql Databases. The PHP server is all up at this time and you can use it to access your MySql Databases

You cannot connect to your MySql server directly from JS but you write the PHP code that will be processed as the action in your <FORM> The PHP commands that are used to access the MySql DB can be found in the PHP

help files supplied in the download but at the most fundamental level they

are something like this...The Access is set in MYSQL through the MySql control panel when you create or administer the DB.

$link=mysql_connect("server address", "User Id", "Password")

To set the link to the server

mysql_select_db("My Sql DB name")

To open the Database

$sql = "SELECT * FROM MyTable";

The SQL statement you want to process

$result = mysql_query($sql)

The result of the SQL statement

while($t = mysql_fetch_row($sresult))

{

... do stuff ....

}

Loop through the result set.


I can only speak with some clarity on the Apache/PHP/MySql package below

and I will be glad to point you in the right direction if you get stuck.

Steve
Copy linkTweet thisAlerts:
@BritMissauthorAug 22.2005 — Thanks Steve. Um... a (download) link?

Something missing here.
Copy linkTweet thisAlerts:
@DarkRedSpiralAug 23.2005 — Myscha

Sorry that may have been misleading... ?

if you go to http://www.firepages.com.au/phpdev5.htm

and look for a link called [b]dev5beta3.exe[/b] it is 11.5 Mb!

This will install a pre-configured APACHE server, PHP CGI engine and MySql

onto your PC which will work fine for a Local single PC. (you have to play with the settings to get it to work on an INTRANET)

Regards

Steve
×

Success!

Help @BritMiss spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...