Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Obtaining Data from SQL
Old 05-30-2007, 11:35 AM Obtaining Data from SQL
Junior Talker

Posts: 2
Name: mike
Trades: 0
Hi all,

I have a SQL server db containing all of my data. I have written about 10 queries that all return 18 rows , 2 columns of data. I'm trying to setup a web page that display these tables and dynamically update. I have pondered using sql stored procedures and XML but was wondering if anyone had any better idea's of exactly how to achieve this?

Thanks for any info
Retro
retro is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-01-2007, 06:42 AM Re: Obtaining Data from SQL
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,518
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
depends on what server side code you are running.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-01-2007, 09:16 AM Re: Obtaining Data from SQL
Junior Talker

Posts: 2
Name: mike
Trades: 0
How do you mean? The queries I'm running are very simple select statements.
retro is offline
Reply With Quote
View Public Profile
 
Old 06-01-2007, 11:49 AM Re: Obtaining Data from SQL
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,518
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
SQL can't write HTML or XML, so you will need something to take the output from the SQL server and translate that into code that can be displayed via a web browser.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-01-2007, 02:25 PM Re: Obtaining Data from SQL
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
SQL can do XML with SELECT [CLAUSES HERE] FOR XML. If all you're trying to do is run the queries and dump the results to the web, any of the dozen easy solutions will do just fine. If you're trying to make the data updatable, where the user can type in new values and save them to the database, you have more work ahead of you.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-07-2007, 10:28 AM Re: Obtaining Data from SQL
Average Talker

Posts: 27
Name: Mike Robinson
Location: London, England
Trades: 0
Quote:
SQL can't write HTML
The following works easily on MySQL and just builds a HTML table with the contents of col_A and col_B. Ignore the ord column as it's used for ordering and just print out the html column.

Code:
select 0 as ord, "<table>" as html
union
select 1, concat( "<tr><td>", col_A , "</td><td>", col_B,"</td></tr>" )
from my_table
union
select 2, "</table>"
order by ord
If you only have 18 rows is it really worth having a database? would it be easier just printing out your 18 values?

Mike
mike_bike_kite is offline
Reply With Quote
View Public Profile Visit mike_bike_kite's homepage!
 
Old 06-07-2007, 12:29 PM Re: Obtaining Data from SQL
VTWebProperties's Avatar
Skilled Talker

Latest Blog Post:
WEB 2.0 Apps For iPhone
Posts: 64
Name: Ed
Location: Vermont
Trades: 0
The FOR XML is great if you don't have a high server load pulling the data down. If the data need only be updated say every 15 mins then this is a great way to generate XML data on the backend and use XSL to display it.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VTWebProperties is offline
Reply With Quote
View Public Profile Visit VTWebProperties's homepage!
 
Old 06-07-2007, 10:23 PM Re: Obtaining Data from SQL
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,518
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by mike_bike_kite View Post
The following works easily on MySQL and just builds a HTML table with the contents of col_A and col_B. Ignore the ord column as it's used for ordering and just print out the html column.

Code:
select 0 as ord, "<table>" as html
union
select 1, concat( "<tr><td>", col_A , "</td><td>", col_B,"</td></tr>" )
from my_table
union
select 2, "</table>"
order by ord
If you only have 18 rows is it really worth having a database? would it be easier just printing out your 18 values?

Mike
And you would call the SQL query from a browser and output the data to the browser by using ? ......
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-08-2007, 03:14 AM Re: Obtaining Data from SQL
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
Simple web server code, and more intra-server traffic. It's a cool idea, but winds up moving the complexity from PHP to MySQL.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 06-08-2007, 07:01 AM Re: Obtaining Data from SQL
Average Talker

Posts: 27
Name: Mike Robinson
Location: London, England
Trades: 0
Quote:
And you would call the SQL query from a browser and output the data to the browser by using ? ......
If his 18 rows are in the database then he'll need SQL to extract them. If he wants to view the output on a web page then he'll need a program running on the server to run the SQL from (if it's MySQL then php is an obvious choice). I was simply trying to save him the time and effort of learning XML and possible XSLT - it just seemed like overkill to me.

If there are so few rows to extract and, if they don't change very often (I'm assuming a lot here), then it might be better not using a database at all and just updating a static web page.

Mike
mike_bike_kite is offline
Reply With Quote
View Public Profile Visit mike_bike_kite's homepage!
 
Reply     « Reply to Obtaining Data from SQL
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.65107 seconds with 12 queries