Log in

View Full Version : Need Scripts To Display SQL Data On A Web Site



nashfire
04-08-2009, 11:01 PM
I need a script (or set of scripts) that will pull data elements from an SQL database, package them (as XML?) and push the file to a web site where the data will be displayed (probably in a table). Details: I want to retrieve incident information from a public safety database and display that information in real or near real-time on a web page. The database resides on a server inside a domain, and needs to be FTP'ed to a web site on the world wide web.

Thanks for reading,

Ed

forum_amnesiac
04-14-2009, 10:31 AM
I have managed to get data from a MYSQL database using PHP.

I extracted all the data required into an array using PHP.

I then converted that array into a javascript array.

I was then able to interrogate the array for a specific element, chosen using SELECT OPTION in a form, and extract the individual fields using .split. I culd then display the individual fields for a specific MYSQL record.

I have also used a for loop to display the elements to the screen.

The most difficult part of this for me was converting the PHP array into a javascript array.

If any of this would help you then let me know

traq
04-14-2009, 03:17 PM
I'm learning about this as well. You don't really need JS to interpret the array; use the echo command to write your table directly from php. Start here (http://www.w3schools.com/php/default.asp), here (http://www.w3schools.com/php/php_mysql_intro.asp), and here (http://us.php.net/mysql).

forum_amnesiac
04-14-2009, 03:32 PM
The echo command is perfect for presenting the contents of the table, however, I found that if I wanted to create the OPTIONS for a SELECT in a form, choose a record and display the details of that then using a javascript was the best way.

This way I could retrieve all of the base data that I needed, allow a choice to be made, display and use the relevant field data and accept other input.

I use this method when creating a HTML email, the data table contains addresses, contact details, etc for a number of companies. The selection of the company fills in certain fields, the main details of the email are entered and the email is sent.

I use Formmail for the email, mainly because I like its validation, flexibility and most importantly - it's free

sitedesigner
04-15-2009, 05:50 PM
: There are many reasons why you might like to edit your site content via the net, including ease of use, multiply editor for a site and even a single page as well as authorization of users. Luckily, there are several "Content Editor" on the market that come to the rescue, and in this post we will like to recommend Toko Content Editor.

nashfire
04-17-2009, 11:12 PM
Do you have a working example I can view?

forum_amnesiac
04-18-2009, 05:36 AM
try this link, the initial PHP is to set up the OPTIONS in a select box from the contents of the table.

It also sets up a delimited array which is then converted into a JS array.

There is then a JS funtion which takes the selected OPTION and retrieve the relevant data from the JS array and displays the fields on the form.

The only thing to ensure is that the first field in the array is also the field on which the PHP sort is done and that is used in setting the SELECT options.

www.cognac-jaugeage.com/jaugeage-formmail.php

nashfire
04-18-2009, 02:11 PM
Got a 404 error.

forum_amnesiac
04-18-2009, 04:22 PM
sorry, typo


http://www.cognac-jaugeage.com/jaugeage_formmail.php

If you look at the input field Drire the OPTIONS are populated from the database, the address details etc are populated by reading a JS array originally created by PHP.

The HTML email is created by FormMail, a free HTML email program.

Please don't create an email, this is a production system, ie it's live

If this is type of thing that you want then I can send you a stripped down, reasonably commented version that does this.

nashfire
04-18-2009, 11:34 PM
Not quite what I am looking for. See http://www.nashfire.org/live_inci/Incident.htm for an example.

Ed

SenHu
04-21-2009, 08:37 PM
You can use biterscripting for dynamically creating html tables from data. There are several examples on the web. To download, follow installation instructions at http://www.biterscripting.com/install.html . If you email me very specific requirements, I can help you write a script quickly.

Sen

columbusman
09-15-2009, 02:56 PM
Not quite what I am looking for. See http://www.nashfire.org/live_inci/Incident.htm for an example.

Ed


I would like to know the script you are using, I want to pull refer info from my stats page and place on my primary website.

I run my own server and use phpmyadmin which has all my data from all the sites we host, and on this server we have a stats page that links all sites we run, I want to pull data from a specific table in the stats data and show it on my main site.

So basically I just need the starting foundation and I should be able to go from there... Thanks to anyone who can help.. my email is columbusind@ gmail.com

SenHu
10-20-2009, 05:18 PM
I am using a script similar to http://www.biterscripting.com/SS_WebPageToCSV.html . You can try it as follows.

Once you install biterscripting, enter the following command.


scr SS_WebPageToCSV.txt page("http://finance.yahoo.com/q?s=IBM")


It will show you the table for the stock quote.

If I see your exact input and output table samples, I can help you quickly write a script.

Sen