Using variables from cookie values in SQL

It's the syntax of the IF and SQL statements I'm trying to code.


var email = getCookieValue('email'); //already set in previous page
var pword = getCookieValue('pword'); //already set in previous page


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


// more code....
%>

Comments

  • 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:

    [code]set = ((email != "") && (pword != ""));
    if (set) {code... } [/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 [b]VBarray obj [/b]but that's really not necessary when your using the [b]Browser obj[/b].

    : 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
    :
    :
    : <%
    : var strSql;
    : //if ((Request("email") != "") && (Request("pword") != "")) {
    : if ((%>email<% != "") && (%>pword<% != "")) {
    : strSql = "SELECT email, pword FROM logintable where email =
    : '"
    : + email +
    : "' and pword = '" + pword + "';";
    :
    :
    : // more code....
    : %>
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion