OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

Default Values

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Default Values
Page: [1]
 
 
ThumperZA

 

Posts: 12
Joined: 6/21/2007
Status: offline

 
Default Values - 2/20/2009 5:56:25   
I am trying to combine normal scripting and DRW to match a value already specified in the page with a value from the DB.

A script collects the username from the login page and carries it throughout the site on every page which works fine.

Now I want DRW to lookup the value of username within a table where the field is called agent but I dont seem to be getting the format right.

SELECT * FROM PSADATA WHERE Agent='username'

This brings no results, probably coz its looking for the exact phrase username, what is the correct format to collect an already predefined value ? For example I can display the value by using <%= username %> or response.write username
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: Default Values - 2/20/2009 7:31:49   
quote:

SELECT * FROM PSADATA WHERE Agent='username'


If using DRW, it should be
SELECT * FROM PSADATA WHERE Agent='::username::'

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to ThumperZA)
ThumperZA

 

Posts: 12
Joined: 6/21/2007
Status: offline

 
RE: Default Values - 2/20/2009 7:52:39   
I have tried that and still no records were returned.

If I write for example:

SELECT * FROM PSADATA WHERE Agent='Jermaine Wood'

Then the correct recrds are selected

Is there any way to test that ::username:: contains data if that makes sense.

http://196.211.66.82/pmsadfb/test.asp

< Message edited by ThumperZA -- 2/20/2009 8:31:29 >

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: Default Values - 2/20/2009 9:21:25   
How did you pass the value of username?

I see your test page is also not displaying correctly when you response.write username. If it prints blanks, it means username is not passed correctly.

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to ThumperZA)
ThumperZA

 

Posts: 12
Joined: 6/21/2007
Status: offline

 
RE: Default Values - 2/23/2009 4:10:32   
You wont see a username value because you have not provided a value (logged in). When I log in the username is displayed corerctly.

My first post says: "For example I can display the value by using <%= username %> or response.write username "

I wouldnt know if it was safe to post the login/username code here unfortunately.

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: Default Values - 2/23/2009 5:47:14   

quote:

ORIGINAL: ThumperZA

You wont see a username value because you have not provided a value (logged in). When I log in the username is displayed corerctly.

My first post says: "For example I can display the value by using <%= username %> or response.write username "

I wouldnt know if it was safe to post the login/username code here unfortunately.


duh

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to ThumperZA)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Default Values - 2/23/2009 15:05:07   
Assuming th other pages are using a session value, then you need to use this in the query code

eg :

SELECT * FROM PSADATA WHERE Agent='"&Session("Username")&"'"

If you are logged in, then this should display what you are logged in as (assuming "Username" is the name of the session) :

<%=Session("Username")%>

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to William Lee)
ThumperZA

 

Posts: 12
Joined: 6/21/2007
Status: offline

 
RE: Default Values - 2/24/2009 0:21:18   
Hi Spooky

I get this error when verifying the query:

Server error: Unable to retrieve schema information from the query:

SELECT * FROM PSADATA WHERE Agent='"&Session("Username")&"'"

against a database using the connection string

DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/PSA.mdb.

The following error message comes from the database driver software; it may appear in a different language depending on how the driver is configured.
-------------------------------------------------------
[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression 'Agent='"&Session("Username")&"'"'.

Source: Microsoft OLE DB Provider for ODBC Drivers
Number: -2147217900 (0x80040e14)


I have also found out that the session is the userid, username has reference to:
username = R("username") Please see image below.

Results Image

< Message edited by ThumperZA -- 2/24/2009 1:00:01 >

(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Default Values - 2/25/2009 14:03:43   
If you are using the DRW, youll get that error, however you can modify the source code directly to use the session rather than through the wizard


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to ThumperZA)
ThumperZA

 

Posts: 12
Joined: 6/21/2007
Status: offline

 
RE: Default Values - 2/26/2009 0:32:31   
I didnt have much luck getting this to work the "easier" way. For some reason the only way I could get this to work was to create a page before the DRW page that posted the username session to the DRW page by means of a hidden form field and a auto redirect.

The value of the username session just never wanted to work in a sql statement. Although the statement is in the correct syntax.

Thanks for the efforts.

(in reply to Spooky)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Default Values
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts