Convert php2ASP "suggest" method back end (isset?, echo?..)

Last post 07-17-2009 5:08 AM by gunteman. 1 replies.

Sort Posts:

  • Convert php2ASP "suggest" method back end (isset?, echo?..)

    07-17-2009, 12:31 AM
    • Member
      39 point Member
    • Motiofel
    • Member since 03-13-2009, 10:43 AM
    • Posts 87

    So I found a nice tutorial to create a suggest box (something like google suggest),

    but oh dear the back end is in PHP..

    I tried convertors but none of them did the job.

    Any Idea how does this code should look in C#? (asume it should be in the code behaind)

    //Get our database abstraction file
    require('database.php');
    
    
    ///Make sure that a value was sent.
    if (isset($_GET['search']) && $_GET['search'] != '')

    //Add slashes to any quotes to avoid SQL problems.
    $search = addslashes($_GET['search']);
    	while($suggest = db_fetch_array($suggest_query)) {
    //Return each page title seperated by a newline.
    echo $suggest['suggest'] . "\n";
    }
    Groet,

    Moti H.
  • Re: Convert php2ASP "suggest" method back end (isset?, echo?..)

    07-17-2009, 5:08 AM
    Answer
    • All-Star
      21,648 point All-Star
    • gunteman
    • Member since 07-11-2007, 8:57 AM
    • Norrköping, Sweden
    • Posts 3,177

    That code doesn't do much, so there's no point in translating it...

    1. It checks if Request.QueryString["search"] contains anything
    2. It uses the value in Request.QueryString["search"] to search the database
    3. It returns the data from the database, one line per result hit

    -- "Mark As Answer" if my reply helped you --
Page 1 of 1 (2 items)