SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql_result() problems



    Hi guys, i was following this video tutorial.. then i came across this function - mysql_result($query_run,0,'id') .Is at the video time 7:00.
    Ok, the problem is i have been using mysqli to connect to my db, mysqli_query etc.
    I tried using mysql_result($query_run,0,'id') but it give me this error - mysql_result() expects parameter 1 to be resource.
    Then i tried mysqli_result($query_run,0,'id') they give me this error - Call to undefined function mysqli_result()

    So is the a way to solve this without changing all mysqli to mysql and able to get the same result?

    thanks

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    The MySQL result function was changed in MySQLi into a class of methods which you can see here, the method you would want to use would be mysqli_result::fetch_array which returns an array with the results you requested.
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  3. #3
    SitePoint Member
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris.upjohn View Post
    The MySQL result function was changed in MySQLi into a class of methods which you can see here, the method you would want to use would be mysqli_result::fetch_array which returns an array with the results you requested.
    Thanks for the clear explanation! I tried mysqli_fetch_array, it works exactly as what is intended. Thanks for your help

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    No problem, glad you got it working
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle


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
  •