Forum Moderators: phranque

Message Too Old, No Replies

SQL query

DB Driven site

         

Marketing Guy

4:07 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi folks

Ive wandered into my first attempt at driving my site from a database. I know - something I should have been doing ages ago, but it's really not my forte! :)

Im using Frontpage for the site and Access for the database.

Right now, im just messing with a simple one table, 5 field DB until I get to grips with setting it all up.

What Im trying to do is:

1. Display a list of records, 1 record per row (say, 3 fields in total).
2. One field in each record will be a link to more information.
3. User clicks link and a new page is generated with all the fields for that one record.

I am using FP´s DB Results Wizard to generate stage 1 - list of records - no problem there.

I add HTML to the more_info field in the DB to create the link for stage 2.

I have been using the format:

<a href="results_page.asp?id=xx>link text</a>

(results_page.asp is the template for the dynamic page and xx is the ID number for the record I want displayed).

The link works fine, and the page loads, but the "no matching records" message appears. I have only 2 test records in just now and made sure that the ID number on the records and link matched.

I used the "insert custom query" function on the DB results wizard to insert the following SQL query (hastily made with quick reference to a couple of websites):

SELECT * FROM dbname WHERE
more_info = 'On'

Im pretty sure this is where ive gone wrong - dont really have a clue about SQL! :(

Am I way off ball or so close that I should be smacking my head against the wall? ;)

I would appreciate any input anyone has to offer!

Cheers
Scott

sun818

4:32 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Scott, I find that visitors to WW tend to know PHP/mySQL and only a few work with the ASP/Access combo. A resource that I am frequently referred to is 4guysfromrolla. They will go more in depth and provide examples for your specific situations. That's the best advice I can give.

Marketing Guy

4:36 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cheers Sun818 ill give it go! :)

Scott

Sinner_G

4:42 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've used ASP/Access before, but never FP, so it's difficult to say anything based on that wizard thing. Can you post the piece of code where the query is?

Marketing Guy

5:00 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The code is the usual FP mess - TBH, i cant make out the difference between ASP and the stuff FP sticks in - I dont either well enough.

What I posted above is perhaps as clear as I can make it! :)

No matter - Ill hunt around MS knowledge base and if I cant find a solution, Ill leave it.

We dont really need it done - I just thought I would try it out to save a bit of time later on.

Ill most likely just work on my ASP and move on to Dreamweaver then! :)

Cheers folks!

Scott

Staffa

5:43 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I found that an sql query does not respond well to on/off - yes/no, etc.
You might try this :

DIM infois

infois = On

"SELECT * FROM dbname WHERE more_info = " & infois

the query line all on one line, no line break.
Good luck

Sinner_G

5:46 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't want to start the WYSIWYG vs. text editor war again, but if I were you, I would indeed work on ASP and then try hand-coding. I find it much easier for dynamic pages.

As for the difference between ASP and FP code, the ASP parts start with a <% and end with %>. All which is inbetween is ASP, outside is HTML.

Marketing Guy

6:00 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree Sinner, thats the way I should be going and I intend to look further into it in the future (I originally intended to study Computing Science or Software Engineering).

But as it is, I have more of an aptitude for marketing, sales and business than IT, so that's where my time goes! :)

TBH, I found even hand coding HTML at uni pretty tedious, so WYSIWYG editors are a godsend for me.

I found a solution to the problem though (on MS knowledge base) - ditched the custom query and used the search box function (and removed the visible components). Perhaps not idea, but it does what I want it too!

(and with a graphic designer as an IT manager, outward appearance is a much greater factor - and pressure - on my time than a technically sound site unfortunately).

"The pages are to heavy - they´ll take ages to load" (me)
"Well, visitors well just have to wait, wont they" (him)

Scott :)