Jump to content

mysqli_result() --> undefined?


Solarpitch

Recommended Posts

Hey,

Does anyone know why I am getting an error saying that mysql_result() is undifined? I even try it as mysqli_result() and I still get the message.

$total_results = mysqli_query($mysql_connect, "SELECT COUNT(*) as Num FROM pages");
mysqli_result($total_results,0);

This code is a snippet from the pageination tutorial on the site that huggie pointed me too!
Link to comment
Share on other sites

Just go to php.net and download the zip file which contains a library of functions in the ext folder. Extract the contents to where you would keep you extentions then uncomment the dll in the php.ini file. Restart your web server.

The windows installer version does not contain the extra dll's

Ray
Link to comment
Share on other sites

Open your PHP.INI, and find these...

[code];extension=php_mysql.dll
;extension=php_mysqli.dll[/code]

And then uncomment them...

[code]extension=php_mysql.dll
extension=php_mysqli.dll[/code]

Then restart IIS

Also have a look at this post, so PHP can find the dynamic dll(s) it needs to load the mysql and mysqli extensions!

bottom post!

http://www.phpfreaks.com/forums/index.php/topic,110716.0.html


me!
Link to comment
Share on other sites

once you download the proper zip file for the version of php you are using open the zip files and extract the ext folder to your php directory. I didn't want to flood out the page so I made images links :)
http://www.theelders.net/misc/phpfiles.jpg

After you have the extension in the directory you want you have to edit the php.in  file
change the lines below. Make sure you put the paths in correctly
http://www.theelders.net/misc/phpini1.jpg

Also in the ini file add the extension for the mysqli.dll. mysql.dll is there just need to uncomment but mysqli.dll is not. I am not sure on all the different versions but mine was not there, I had to actually type it in
http://www.theelders.net/misc/phpini2.jpg

Once that is done restart your web server and should be all set

Ray
Link to comment
Share on other sites

Ok . . I may have found the problem...

$total_results = mysqli_query($mysql_connect, "SELECT COUNT(*) as Num FROM pages");
echo $total_results;

mysql_result($total_results,0);

The echo displays "Object id #3" . . so I take it the incorrect value is being passed into the function! But why is it doing that?
Link to comment
Share on other sites

Well you are echoing out the query which is and object so you will be getiing that. You need to echo out the RESULTS of the query. Also a good idea to seperate your query parts. you are also using 2 different functions either use mysql or mysqli not both.

[code]<?php
$sql = "SELECT COUNT(*) as Num FROM pages";
  $res = mysqli_query($mysql_connect, $sql) or die (mysqli_error());
    $r=mysqli_fetch_assoc($res);
echo $r['Num'];
?>[/code]
Ray
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.