JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Using variables from cookie values in SQL Posted by sapmanie on 3 Feb 2008 at 9:00 AM
It's the syntax of the IF and SQL statements I'm trying to code.

<script type="text/javascript">
var email = getCookieValue('email'); //already set in previous page
var pword = getCookieValue('pword'); //already set in previous page
</script>

<%
var strSql;
//if ((Request("email") != "") && (Request("pword") != "")) {
if ((%>email<% != "") && (%>pword<% != "")) {
strSql = "SELECT email, pword FROM logintable where email = '"
+ email +
"' and pword = '" + pword + "';";


// more code....
%>
Report
Re: Using variables from cookie values in SQL Posted by CyGuy on 3 Feb 2008 at 9:32 AM
1. the variables being compared should assigned in native language as is done where comments read already set in previous page

you can even compare first and condition later like so:

set = ((email != "") && (pword != ""));
if (set) {code... } 


2. any environment that i have ever worked in requires you to specify that you are using JScript or JavaScript after the short tag <%

You may accept variables from the VBarray obj but that's really not necessary when your using the Browser obj.

: It's the syntax of the IF and SQL statements I'm trying to code.
:
: <script type="text/javascript">
: var email = getCookieValue('email'); //already set in previous page
: var pword = getCookieValue('pword'); //already set in previous page
: </script>
:
: <%
: var strSql;
: //if ((Request("email") != "") && (Request("pword") != "")) {
: if ((%>email<% != "") && (%>pword<% != "")) {
: strSql = "SELECT email, pword FROM logintable where email =
: '"
: + email +
: "' and pword = '" + pword + "';";
:
:
: // more code....
: %>



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.