I would like to create a website with a list of addresses/names/phone numbers for different categories. Kind of like a directory. I would like to pull this information from a database if possible. Is there any way to do this?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
OK. So I am working on antiquesinva.com . On the index page I have a pull down menu. I'm trying to get the first option "Portsmouth" to work. The portsmouth.asp page comes up, but is not displaying the information I had hoped. I created portsmouth.asp hoping to pull information from a database. The database is called antiquesdb, but the table is called stores. I can't get any info from the database to show. Help please!!
This isn't a quick and easy thing to explain. What's in this asp file you created? 1st you need to make a connection to the database, and you need to know the connection string for that database. You need a SQL statement, such as:
SELECT blah FROM tableName WHERE someCondition = someValue;
I assume you plan to use vbscript as the scripting language.
In the portsmouth.asp file it says:
<%@ Language="VBScript" %>
<% Option Explicit %>
and in the body of the html it says:
SELECT store_name, store_address, store_city, store_phone
FROM stores
WHERE store_city = 'Portsmouth'
ORDER BY store_name;
But when the website loads it just displays all my code! How do I get the database to load?
You don't have a database named stores or if you do you haven't made a connection to it.
You don't have any code that creates or reads a record set that would be returned by your SQL query.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
But that's not close to a complete asp file. There's no connection to the db, there's no loop, there's no variables to hold the data, surrounded by the displaying elements for the html.
<BODY>
SELECT store_name, store_address, store_city, store_phone
FROM stores
WHERE store_city = 'Portsmouth'
ORDER BY store_name;
</BODY>
</HTML>
I know my server does support ASP. I got a test page to work on it. I use godaddy.com. My database is called "antiquesdb", but the actual table I want to use is called "stores". Can someone give me the code I need to connect to my database? I really, really want to learn how to do this. I hope you all have patience to work with me.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
Bookmarks