Upgrading database query code to MYSQLi or PDO

Discussion in 'MySQL' started by pmf123, Feb 29, 2016.

  1. #1
    Are there direct command replacements for the following, or is there more to it than that?

    $st1 = "SELECT * from `members` WHERE (memberid ='$usernum')";
    $r1 = mysql_query($st1, $sqlsession);

    if (mysql_num_rows($r1) )
    {
    while ($r2= mysql_fetch_array($r1)) {
    [whatever]
    }
    }

    I know the above well, but new to MYSQLi or PDO

    Thanks!
     
    pmf123, Feb 29, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You're in the wrong forum - this has nothing to do with mysql, it does, however, have everything to do with PHP. I suggest you take your question there. I'm on my phone, elsewise I'd write a suggestion.
     
    PoPSiCLe, Feb 29, 2016 IP