472,960 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,960 software developers and data experts.

HELP! Urgent. Using JS to retrieve data from DB = mission impossible?

We are trying to develop an Engineering application using PHP,
Javascript with Informix as the back-end.

Is it possible to retrieve data using Javascript but by accessing the
Database. Say somebody enters part_no, than using Javascript is it
possible to connect to the part master and retrieve the division and
desc information?

I am not allowed to use the PHP because this will require the user to
insert the part number on the first page (user input page) and then
retrieve the information using PHP and display the info on the second
page (processing page).

I will need this to be done on the same page. That means the info will
need to be retrieved instantly (on the fly).

I think of building a javascript array for the part master table using
PHP but finally decided not to as the table is a huge table (contains
more than 1000000 records).

Thanks in advance for your kindness help.

Mar 2 '06 #1
5 2391
gg****@gmail.com wrote:
We are trying to develop an Engineering application using PHP,
Javascript with Informix as the back-end.

Is it possible to retrieve data using Javascript but by accessing the
Database. Say somebody enters part_no, than using Javascript is it
possible to connect to the part master and retrieve the division and
desc information?

Google for AJAX.

--
Ian Collins.
Mar 2 '06 #2
Hi, Ian. Thanks for suggestion. Can you please recommend to me any good
tutorial about AJAX?

Mar 2 '06 #3

gg****@gmail.com wrote:
We are trying to develop an Engineering application using PHP,
Javascript with Informix as the back-end.

Is it possible to retrieve data using Javascript but by accessing the
Database. Say somebody enters part_no, than using Javascript is it
possible to connect to the part master and retrieve the division and
desc information?
In my amateur opinion, yes. For instance, using the HTTPRequest object
(one of the methods used in AJAX).
I am not allowed to use the PHP because this will require the user to insert the part number on the first page (user input page) and then
retrieve the information using PHP and display the info on the second
page (processing page).
You may still need to use PHP or some other intermediary, unless you
are prepared to open your database to remote access (a security issue).
But this does not necessarily involve a change of page.

Effectively the HTTPRequest object will make a request from your client
web page to a PHP web page, which in turn will connect to the database,
extract data, and send this back to the HTTPRequest object. JavaScript
can then collect the information from the HTTPRequest object, and
dynamically update the same page.
I will need this to be done on the same page. That means the info will
need to be retrieved instantly (on the fly).
See above.
I think of building a javascript array for the part master table using
PHP but finally decided not to as the table is a huge table (contains
more than 1000000 records).


A new book on AJAX, is "Professional Ajax" - see
<URL:www.nczonline.net>

Regards

Julian Turner

Mar 2 '06 #4
Julian Turner wrote:
gg****@gmail.com wrote:
We are trying to develop an Engineering application using PHP,
Javascript with Informix as the back-end.

Is it possible to retrieve data using Javascript but by accessing the
Database. Say somebody enters part_no, than using Javascript is it
possible to connect to the part master and retrieve the division and
desc information?


In my amateur opinion, yes. For instance, using the HTTPRequest object
(one of the methods used in AJAX).
> I am not allowed to use the PHP because this will require the user

to
insert the part number on the first page (user input page) and then
retrieve the information using PHP and display the info on the second
page (processing page).


You may still need to use PHP or some other intermediary, unless you
are prepared to open your database to remote access (a security issue).
But this does not necessarily involve a change of page.

Effectively the HTTPRequest object will make a request from your client
web page to a PHP web page, which in turn will connect to the database,
extract data, and send this back to the HTTPRequest object. JavaScript
can then collect the information from the HTTPRequest object, and
dynamically update the same page.
I will need this to be done on the same page. That means the info will
need to be retrieved instantly (on the fly).


See above.
I think of building a javascript array for the part master table using
PHP but finally decided not to as the table is a huge table (contains
more than 1000000 records).


A new book on AJAX, is "Professional Ajax" - see
<URL:www.nczonline.net>

Regards

Julian Turner


AJAX is not the only method. It is also possible to use a script like
this, that accomplishes the same thing.

function GetPartNum(part_num) {
var jsel = document.createElement('SCRIPT');
jsel.type = 'text/javascript';
jsel.src = "somepage.php?part_num="+part_num;
document.body.appendChild (jsel);
}

function GotNewData(desc,division) {

alert("Desc: "+desc+"Division: "+division);

}

And the php file can look like this:

<?

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

$p = $_GET{'part_num'};#may want to do something to avoid injection...

#db connect
#db select database
#run query
#store escaped results in $desc & $div
#output results as a javascript function
echo "GotNewData(\"".$desc."\",\"".$div."\");";

?>

Now when this is appended, the function is run with the desired
partnumber. This is more compatible then the XMLHttpRequest Object.

There is no speed difference either, they both load as fast as the
server generates the file and how large the content is. Example of both
methods on a timer: http://www.endeavorpub.com/d/stress.php

- JS
http://www.endeavorpub.com/

Mar 2 '06 #5
Thank you very much to Ian, Julian and JS for your valuable advice. I
will need some time to digest the information and also the recommended
methods. I am quite relief now as this problem is actually solvable and
is not a "mission impossible". Lastly, thanks again and take care.

Mar 5 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
4
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
27
by: Bruce Dodds | last post by:
I recently started using Access 2003 for the first time. I wanted to pass on some comments about the Help system to Access MVPs who frequent this board. I'm doing this in the hope that some of...
5
by: TD | last post by:
Hey All, I am hooking up our custom html (.chm) help file to our Access xp application, and, despite reading several posts and manuals on this, I still have a gap in my understanding... OK, so...
0
by: Yabedabe | last post by:
Hello there, I have a strange problem (possible bug?) to display two HTML Help files at the same time. To reproduce this problem. Create a new VB.Net solution. Place two buttons on the form....
3
by: lord.zoltar | last post by:
I've managed to get a nice little chm help system written. Now I need to display it! I added a HelpProvider to my MDIParent form and set the namespace of the HelpProvider to be the help file. So...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.