473,471 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2414
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.