www.webdeveloper.com
Results 1 to 5 of 5

Thread: i have a problem with ' in the end of link

  1. #1
    Join Date
    May 2012
    Posts
    4

    Exclamation i have a problem with ' in the end of link

    When my link: http://xxxxxxxxxx.com/categories.php?id=99 ... the link page is with no problems...but when some one write ' afther the link..like this: http://xxxxxxxxxx.com/categories.php?id=99' .... i have a mysql problem:
    "
    PHP Code:
    Warningmysql_fetch_assoc() expects parameter 1 .... 
    "
    my check is:
    PHP Code:
    if(isset($_GET['cat']))
    $arts_id $_GET['cat'];
    else..... 




    what edits should i do :S ?

  2. #2
    Join Date
    Mar 2011
    Posts
    1,160
    You should always sanitize $_GET and $_POST data with functions like mysql_real_escape_string() to prevent hacking attacks and to avoid problems like the one you're having with random strings. See the php.net page on mysql_real_escape_string().

  3. #3
    Join Date
    May 2012
    Posts
    4
    mm i solved it with
    (int) because it is a number...thank u very much man

  4. #4
    Join Date
    Jun 2012
    Location
    http://laxmitek.in
    Posts
    1
    nice answer ...............Thank you for your sharing!..........this site is best for developers

  5. #5
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    shouldn't it be

    if(isset($_GET['id']))
    $arts_id = $_GET['id'];
    else.....

    since it is ?id=99 in the url.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles