Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Databse-driven website

Status
Not open for further replies.

coachdan

MIS
Mar 1, 2002
269
US
I am looking to build a website where the site owner can make some simple changes to the content himself (descriptions, prices and so forth). It is for an artist and he will need the ability to upload images of his artwork when he wants to add a new piece. I am thinking that the site will need to be database-driven, but I have never done a site like this before. Can someone give me a lead to a tutorial that will walk me through the steps necessary to creating a database-driven website? I will most likely use Access as that is what I am most familiar with. I think I have a pretty good idea on how to set most of it up, but I have no clue how to setup something for him to upload his artwork images. He is not very PC literate and could not handle using an FTP web administration site. It would need to be something he could do from his website where maybe he could browse his HD for the artwork and click upload. Everything else would have to done behind the scenes if possible. Anyone with any links to examples such as this or tutorials (or even tips)?

coachdan32

 
If you're starting from scratch on this and you've not working with Server-Side code or Database driven sites before then i can firmly reccomend using MacroMedia ColdFusion.

It's a simple tag based launage that will get you a site up and running farely simply, it has a great bunch of features to help you get started, such as friendly error messages and the fact its very robust and logical to code with.

A couple of links to get your started on this.

- ColdFusion tutorials and rescource site, if you need to achieve anything in coldfusion, you'll be able to find plenty of help here.

- The ColdFusions section of Tek-Tips.

There are a stack of other launguages that'll be able to do similar tasks, such as PHP, ASP and JSP, but in my personal experience Coldfusion seems to be the best of the bunch, but do a little re-search and make your own mind up.

Thanks,

Rob
 
I would vote for PHP & MySQL. I'd recomend picking up the book "PHP & MySQL for Dynamic Web Sites" by Larry Ullman $30. Great book to learn by. Most of your less expensive web hosts out there will support PHP & MySQL where you may need a more expensive plan if you want to use Microsoft SQL or ColdFusion.

That's just my $.02 worth.
 
A word of caution.
If you have no experience in doing this it will probably take longer and be more troublesome than you imagine.
You must ensure that whatever you do is secure against various attacks and properly traps errors etc.

It may be worthwhile looking at some "out of the box", open source software such as Joomla! etc.

You might also wish to consider building a straight HTML site and letting your client use Macromedia Contribute to edit the pages as and when needed.

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Ham and Jam - British & Commonwealth forces mod for Half Life 2
 
I second Foamcow's advice. You're about to take on a big challenge if you've never created a data-driven website before. I'm a asp.net/sql server developer but it'll take some time to learn. Both can be obtained for free, but as someone mentioned above it will cost you more to host. Development time between asp.net/sql server and php/mysql will be no different (can't comment about coldfusion), but hosting for php/mysql will be cheaper (unless prices have come down since the last time I checked). I choose a language and get a book.

if you want to try asp.net/sql server then check out...

 
It may be worthwhile looking at some "out of the box", open source software such as Joomla! etc.

I third that... =D

However, if you're serious about learning a web backend programming language and database, then I'd strongly suggest asp.net (either c# or vb.net) with a SQL server database solution (especially if you're just beginning). I'm not saying either are the easiest to learn, but you get the most for free outta both. For example, in .net, you don't have to deal with manual form postbacks, which you have to deal with in php or any other scripting language (true, you could write your own handlers for that, but I'm strictly talking 'bout out of the box).

As for security, which is obviously and for good reason, one of the biggest concerns about web development, both asp.net and sql server offer a whole bunch of protection that other database solutions and languages don't. For example - asp.net by default checks for "unsafe" code (potentially malicious replies from clients). SQL server (if used properly, i.e. stored procedures instead of "embedded queries") will actually sanitize the user input before running the query - makes SQL injection attacks much more difficult (if not impossible).

Anyways - those are just a few thoughts to get you on track. Another really nice thing is that .net is compiled, so it is only loaded into the web server's memory once (as opposed to having to interpret script every time it runs), but that's a pretty minor issue unless you're expecting a ton of traffic...

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Hi

AtomicChip said:
in .net, you don't have to deal with [gray](...)[/gray]
Sorry, I do not want to start flooding. Is my point of view, I know that not everybody shares it and I know what the counter arguments would be.

I had a workmate, a good programmer. But a .net fan. And he was firmly convinced that the session things ( yes, things, because he was not sure exactly what ) are transmitted between client and server somewhere in a secure place, not in HTTP header or in the HTML document. This happens when you start with .net : it distorts the facts, you do not see what happens and will have false concepts. Ok, .net things may be efficient productivity tools, but I not recommend it for beginners.

Feherke.
 
I don't think that .NET distorts facts, you just don't have to know those facts in order to use it. As far as it not being for beginners, you have to start somewhere and why not with .NET? It's a super powerful framework and I have always been able to accomplish what I've set out to do. Also the framework is for web as well as windows applations, console apps, windows services, web services, and a tons more. Furthermore the IDE is great. I would certainly recommend it to beginners (I would also recommend buying a book).

Everyone's a beginner something; you can't just jump straight to being an expert ;-).
 
Foamcow said:
A word of caution.
If you have no experience in doing this it will probably take longer and be more troublesome than you imagine

Ahhhh, spoken like a true PHP Programmer ;-)

I've not been on the boards for a while and thought I'd come and reinforce the benfits of ColdFusion against all the other server side options.

First of all, I appreciate you are new to Server Side work, and as the other guys have already spoken, its bound to be a rocky road ahead, HOWEVER, its worth the elbow grease as learning a server side language opens up a whole avenue of your career, especialy if you concentrate on ColdFusion or .NET then not only are we talking database driven web content, we're talking extensive and powerfull web based applications, there is a great differance I assure you. You can then look into branching into MIS development and all sorts.

Now my experience with .NET is reasonably limited so i wont go into too much detail about what it does or doesn't do, but i can however show you some clear examples of the benefits of CFML over the .NET scripting language, from a coders point of view.

Now, you're going to want to look at the MX7 version of CF to really start utilizing its power, take a look around the basic tutorials here to see how simple it is to achieve some fantastic results.


Now to take a more simple example, infact, probably the simplest of examples, you want to query a piece of data from the database, and then display it on the screen.

Now take a look at the examples of ASP, JSP and ColdFusion, which would you prefer to code with? notice the 'tag based' syntax of CFML? it makes you feel right at home doesn't it?

ASP
Code:
<%
Option Explicit
Response.Expires = 0
Dim objConn, objRS, strQ
Dim strConnection 14:
Set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "Data Source=somedatasource;"
objConn.Open strConnection
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRS.ActiveConnection = objConn
strQ = "select VendorID, Vendor "
strQ = strQ & "from Vendor "
strQ = strQ & "order by Vendor"
objRS.Open strQ
%>

<%
While Not objRS.EOF
Response.Write objRS("Vendor") & ", "
Response.Write objRS("VendorID") & "<br>"
objRS.MoveNext
Wend
objRS.close
objConn.close
Set objRS = Nothing
Set objConn = Nothing
%>

JSP
Code:
<%
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
} catch (java.lang.ClassNotFoundException e) {
e.printStackTrace();
}
Connection myConnection = null;
Statement myStatement = null;
ResultSet myResultSet = null;
try {
myConnection = DriverManager.getConnection ("jdbc:odbc:jsp", "", "");
myStatement = myConnection.createStatement();
myResultSet = myStatement.executeQuery("select VendorID, Vendor from main order by lastname");  

while(myResultSet.next())
      {
      out.println(myResultSet.getString("Vendor")+", ");
      out.println(myResultSet.getString("VendorID")+"<br>");
      }
myResultSet.close();
myStatement.close();
myConnection.close();
} catch (SQLException e) {
e.printStackTrace();
}
%>

CFML
Code:
<cfquery name="Company" datasource="yourDB">
      select VendorID, Vendor
      from tblVendor
      order by Vendor
</cfquery>

<cfoutput query="Company">
        #Vendor#, #VendorID#<br>
</cfoutput>

Keep in mind those are all identical tasks, interesting huh?

Now there is the expense downside to hosting for ColdFusion, however this is minimal, and the costs you will save in man-hours in the development, maintanance and support will more than justify the additional few pounds per month to host the site.

Rob
 
Erm, just reading the post above and noticed you talk about .NET being a complied language, i remember reading this somewhere.

So does this mean that in development i have to re-compile to app everytime I want to test it through a browser?

Rob
 
Ahhhh, spoken like a true PHP Programmer

I didn't mean my comment to be language specific but rather refer to application programming in general. Unless you have experience of how an application should be constructed and understand all the possible ramifications of what you are doing then it will be a bigger job than you think.

It's easy to think in terms of:
1. Connect to the database
2. Submit a query
3. Get the data out of the result
4. Output the data

That's simple.
But, and it's a big but, unless you have the experience then it's unlikely that you will consider validation, security, error trapping, efficiency etc. Unless of course you are very, very gifted.

So, to that end, I suggest the OP use a prebuilt CMS. Preferably one that has a large user base and an active development cycle. If you run into problems there is help there and if a security issue or bug is found then there is a fighting chance it will get fixed (or even found in the first place).

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Earl & Thompson Marketing - Marketing Agency Services in Gloucesterhire
 
The code he posted for asp is not .NET. That code is classic asp and is 3 generations behind (.NET 1.0, 1.1, now 2.0).

As far as re-compiling goes, it depends on what you do. If you write HTML then, no you don't have to recompile. If you change the code-behind (i.e. a compiled class) then yes.

I don't have any experience with ColdFusion, but I am a Macromedia fan (but now that they were bought by Adobe I don't know ;-). However that syntax looks pretty simple. Asp.net is not that simple, but is super powerful and the development environment is awesome (Intellisense everywhere...).

Also, think about what you want to do in the future, there are tons of .NET jobs out there.
 
Oh and...
PHP

Code:
<?php

$db = mysql_connect($host,$username,$password);

mysql_select_db($database,$db);

$result = mysql_query("select VendorID, Vendor from tblVendor order by Vendor");

$data = mysql_fetch_assoc($result);

while($item=mysql_fetch_array($result)){
   echo($item['Vendor'].", ".$item['VendorID']."<br />");
}

mysql_close($db);
?>

I'd normally stick some error trapping in there too which involves a couple of extra lines.
You'd also need to define the username, password, host and database name somewhere. I normally put the connection and disconnection stuff into an external function that I reuse from application to application.

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Earl & Thompson Marketing - Marketing Agency Services in Gloucesterhire
 
As long as we're giving a examples...

Code:
Dim sqlConnection as New SQLConnection = "your connection string"

Dim sqlCommand As New SqlCommand("Select * from table", sqlConnection)

Dim MyDataTable As New DataTable

Dim dataAdapter As New SqlDataAdapter(sqlCommand)

dataAdapter.Fill(MyDataTable)


That'll get all of your information from a database. Then if you want to display all of your information in a really nice grid on the page...

Code:
MyGrid.Datasource = MyDataTable
MyGrid.Databind()
 
Check out Drupal - a PHP/MySQL based CMS with a pretty large user base.

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top