473,761 Members | 7,710 Online
Bytes | Software Development & Data Engineering Community
+ 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 2438
gg****@gmail.co m 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.co m 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 "Profession al Ajax" - see
<URL:www.nczonl ine.net>

Regards

Julian Turner

Mar 2 '06 #4
Julian Turner wrote:
gg****@gmail.co m 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 "Profession al Ajax" - see
<URL:www.nczonl ine.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.create Element('SCRIPT ');
jsel.type = 'text/javascript';
jsel.src = "somepage.php?p art_num="+part_ num;
document.body.a ppendChild (jsel);
}

function GotNewData(desc ,division) {

alert("Desc: "+desc+"Divisio n: "+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
4411
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 the microsoft HTML workshop utility, lets call it c:\path\help.chm. My question is how do you launch it from the GUI? What logic do I put behind the "help" button, in other words. I thought it would be os.spawnv(os.P_DETACH,...
4
3353
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 cmd.Cmd but I would also like to get the man-page-like help for classes and functions. Does anyone know how to do that? Thanks. Sarir
6
3024
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 an html authoring tool to help you accomplish? 2. What do you expect from online help for a html authoring tool? 3. What audience do you think a freeware html authoring tool is directed towards?
27
2824
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 what I say may be passed on to Microsoft. Microsoft has implemented a combination local and web based help system in Access 2003. The local Help installed on your hard drive is fast, but the content is abbreviated. For really useful help you have...
5
2615
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 I've setup the registry keys to have a profile and I specify an AppHelpFile and TitleBar in that profile. This works swell: when I startup my application in runtime with the /profile option and then I press F1 on a form, our help file appears....
0
1511
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. Create two button_click events with the following code in it For button1 Help.ShowHelpIndex(Me, "C:\Temp\File1 mspaint.chm")
3
2031
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 far so good - when I press F1, I get HTML Help popping up with my Help file. This is good but I've been requested to make Help pop up when the user clicks on "Help" in the menu, or on a specific Help Button. I'm trying to trigger the HelpRequested...
10
3364
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 the worst I ever seen. I almost cannot find anything I need, including things I
1
6137
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 default property of object Label. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' Label = New Object(){Box1, Box2, Box3, Box4, Box5, Box6, Box7, Box8, Box9, Box10, Box11,...
0
2887
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 calls MS Excel, so the scenario is that I am supposed to see the Excel Menu bar, FILE EDIT VIEW INSERT ... HELP. I am able to see the menu bar, but in case of Help, I see the Help of Excel and help of my application, both as a submenu of help. ...
0
9345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8780
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.