close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Search recordset based on cookie value

Thread began 6/22/2011 7:54 am by acaciasd344844 | Last modified 6/30/2011 10:33 am by Jason Byrnes | 1985 views | 8 replies |

acaciasd344844

Search recordset based on cookie value

Hi Jason,

You helped me out last time, so here goes. I did look for my older posts but couldnt find them. One of my clients wants their field operatives to be able to view tomorrows work on the login screen before the user has logged in. So using a cookie I can store the users name after the initial login. What I need to know is how do I call the cookie username and compare it to the name held in the database.

for example WHERE appointments.date >= DATE_SUB(CURDATE(),INTERVAL 1 DAY) and employees.emp_name = colname1

Sorry if you have told me before but thanks again


john

Sign in to reply to this post

Jason ByrnesWebAssist

is it a cookie or a session?

your where clause:
employees.emp_name = colname1

suggests you have a variable in the recordset named colname1.

in the advanced view for the recordset, go to the variables section, and edit the colname1 variable to:

Name: colname1
type: text
Default value: -1
Run Time Value: $_COOKIE['username']


if it is a session, not a cookie, then:
Run Time Value: $_SESSION['username']

Sign in to reply to this post

acaciasd344844

Hi Jason,

Thanks for your reply. I dont seem to have much luck with cookies for some reason, I dont know what it is!!! lol.

Here is what is going on, when a user logs into the web page first time, their Username is stored in a cookie (to last 365 days, that's what I set it at) on a mobile device. The user then completes their work orders and finally logs out.

This means the next time they go to the login page it will automatically check who the user is using the cookie; display the following days work order count associated with that particular engineer. So I guess if the work order count is zero then they wont login. Saves a bit of time for them. So no Session variable in use.

So so far I have selected the Form on the page and got it to 'Set Cookie Value' to 'cookusername' and this is retrieved from the username field. I then went to the body section of the page and 'Set The Form Element From' 'cookusername'. So now when the page loads I can see the users name already sitting in the username field.

So far its working fine:

When I try to use it as a variable in the recordset it doesn't work. The recordset works without the variable and displays all the records for every user. Below is the SQL code and basically it shows all work orders for the following day only.

SELECT *
FROM workorders LEFT JOIN customers ON workorders.customerid = customers.customerid
WHERE workorders.workorderdate BETWEEN DATE_SUB(CURDATE(), INTERVAL -1 DAY) AND DATE_ADD(CURDATE(), INTERVAL 1 DAY) and workorders.employeename = colname

The colname variable details are

name: colname
Type: Text
Default value: -1
Runtime value: $_COOKIE['cookusername']

I have checked that the usernames in the database table are all spelt correctly but still nothing!!!

Can you help?

Thanks Jason

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your page please.

Sign in to reply to this post

acaciasd344844

This post has been deleted.

acaciasd344844

This post has been deleted.

acaciasd344844

Here you go ...


at last sorted

Attached Files
m_login.zip
Sign in to reply to this post

Jason ByrnesWebAssist

this page does not have a recordset using the cookie?

I need to see a copy of the page with the recordset on it that uses the cookie value.
.

Sign in to reply to this post

acaciasd344844

Sorry bout that, I had to remove the variable so I could continue working on the additional files.

This next attachment does have it in...

Attached Files
m_login2.zip
Sign in to reply to this post

acaciasd344844

Hi Jason

Did you have any luck with the file I sent you?


john

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...