SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    QueryString HELL

    Hi I'm useless at explaining but ill try my best !

    I have a list of results displayed. On press they go to
    index.asp?ISBNreq=341425 sent <<< query string

    My script on execute uses this querystring. It should know if it exists to display that books details, if not it should ignore and display something else!

    I am using this:
    Code:
    	if(String(Request.QueryString("ISBNreq") ) != "" ){
    			var Qstring = String(Request.QueryString("ISBNreq") );
    			MyQuery = conn.execute("Select * FROM book WHERE ISBN LIKE " + Qstring + " ");
    			var pictureUrl = "bookPics/0" + MyQuery('ISBN') + ".jpg";
    			Response.Write("<tr><td align='center' colspan='3'><img src="+ pictureUrl +">");
    		}
    However it will not parse when browsing to index.asp, it will however if i browse to index.asp?ISBNreq=

    How and whats the correct way to test for querystring ?

  2. #2
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cant you QueryString in JAVASCRIPT ?
    The problem lies with that when there is NO:
    ISBNreq= in the query string ! it cant even see this as undefined! it just doesnt parse!

  3. #3
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK guys my deadline is running short! infact officially bricking it!

    is there a way to pass variables instead of in the query string ? can you say post variables ? that are not in a form ? or call a function from a link which take argument refreshes and displays ?

  4. #4
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you have no "else" statement. and since you've got the first half of a table row in there, i'm assuming that there is an empty last half of a table row hanging loose out there. which might be what you're seeing.

  5. #5
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NO and NO, both of them are OK ! sorry didnt post all the code up as would be prob too much! Just pasted the relevant bit ! Its all about the dynamic SQL query you know! if there is NO ISBNreq= querystring then it will not parse it ! seems strange

  6. #6
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,264
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    I'm betting it's not dealing with the different datatypes. Try using the !== operator and see if that makes a difference.

    I'm sorry I can't be more helpful, but I don't know jscript asp very well (or regular javascript for that matter). I got this operator from the devguru ecmascript reference.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  7. #7
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi DAVE any reply is much appreciated !
    Ive just hit a very funny situation ! Ive neatened my code up some what and all looks clear now!
    but something strange is stopping im sure a simple execution of code!
    here it is
    PHP Code:
    Response.Write("searching for "+Request("searchField"));
    Response.Write("   in   "+Request("categoryField")+"<br>");
    Response.Write("   query   "Request.QueryString("ISBNreq"));

    chosefunction();

    function 
    chosefunction(){
        if(
    Request("searchField") == 'undefined'){
            
            
    displayBook();
        }
        else if(
    Request.QueryString("ISBNreq") == 'undefined'){
            
    DoMyFunction();
        }

    The Response display says 'undefined' etc where it should! but the code will not execute which ever function meets the correct requirements!

  8. #8
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I advise you stick to one thread for a problem
    tjsaynor. It would be better for you & rest of us.

    As in reply to your querystring problem, I told you to
    add a snippet that I posted in your other thread &
    after doing that, it works absolutely fine, it displays
    the results according to the querystring.

    Better check that first before posting for help again.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  9. #9
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tjsaynor
    Cant you QueryString in JAVASCRIPT ?
    You can use querystrings in JavaScript, but you are not using JavaScript here to access querystring. You are using ASP.
    The Request collection is a part of ASP & so is the QueryString function. They have nothing to do with either JavaScript or VBScript.



    Quote Originally Posted by tjsaynor
    The problem lies with that when there is NO:
    ISBNreq= in the query string ! it cant even see this as undefined! it just doesnt parse!
    Actually, the problem is you haven't put together the code which handles the situation when the querystring is empty.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  10. #10
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tjsaynor
    is there a way to pass variables instead of in the query string ? can you say post variables ? that are not in a form ? or call a function from a link which take argument refreshes and displays ?
    Yes, there are ways to pass variables to a page without using querystrings. You can either use a form to pass them on or use SOAP to pass them. But to pass variables to a page through a link or a button, you can use only querystrings.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  11. #11
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did tell you previous i changed all the code and when you postsed that snippet of code i did try it and it didnt work !
    I agree i posted too many times though! apologies for that but thought would would remain in javascript not moved here!

    Cheers Funda

  12. #12
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here's what sorted it ! ALSO the SQL query had errors in too especially in the previous version you looked at. I sorted them after doing my research!
    but the code that sorted calling the correct functions is this:
    PHP Code:
    function chosefunction(){
        if(
    String(Request.QueryString("ISBNreq")) != 'undefined'){
            
    displayBook();
        }
        else{
            
    DoMyFunction();
        }


  13. #13
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    so, is it working alright now?
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •