+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: PHP: SQL Injections

  1. #11
    vedran's Avatar
    vedran is offline Newbie
    Join Date
    Aug 2008
    Posts
    18
    Rep Power
    0

    Re: PHP: SQL Injections

    I'm getting following messages in my browser:

    Code:
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/omeragic/public_html/rebus/test/index.php on line 38
    
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/omeragic/public_html/rebus/test/index.php on line 40
    What is causing them?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #12
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: PHP: SQL Injections

    That error is due to an invalid query being supplied.

  4. #13
    Ricardo-san is offline Learning Programmer
    Join Date
    Jan 2009
    Posts
    54
    Rep Power
    12

    Re: PHP: SQL Injections

    Thanks, excellent article. Learned quite a lot.

  5. #14
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: PHP: SQL Injections

    I am glad you liked it.

  6. #15
    kailas is offline Newbie
    Join Date
    Feb 2010
    Posts
    16
    Rep Power
    0

    Re: PHP: SQL Injections

    thanks for the clear tutorial

  7. #16
    fyhring4 is offline Newbie
    Join Date
    Jan 2009
    Location
    Denmark
    Posts
    13
    Rep Power
    0

    Re: PHP: SQL Injections

    Instant of using the function array_map can't you use the foreach function?
    Like this:
    Code:
    foreach($_GET as $key => $value){
        if(
    get_magic_quotes_gpc()){
        
    $_GET[$key] = stripslashes($value);
        
    $_GET[$key] = mysql_real_escape_string($value);
        }else{
        
    $_GET[$key] = stripslashes($value);
        
    $_GET[$key] = mysql_real_escape_string($value);
        }

    Or is it better without get_magic_quotes_gpc()?

    Code:
    foreach($_GET as $key => $value){
        
    $_GET[$key] = stripslashes($value);
        
    $_GET[$key] = mysql_real_escape_string($value);


  8. #17
    Join Date
    Jun 2010
    Location
    Vancouver, Eh.
    Posts
    4,014
    Blog Entries
    7
    Rep Power
    39

    Re: PHP: SQL Injections

    @fyhring4: You can use foreach, but array_map relies on slightly more internal principles, atleast in development less code is often better, especially if it is more efficient. Your code makes not very much sense though, you may wish to wrap that reusable code in a function.
    Be sure to read the updated FAQ || Health is achieved through 10,000 different steps.
    A textual description can be only part of your question, be sure to provide sample results, errors and your platform in the appropriate forums while asking.

+ Reply to Thread
Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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