Solarpitch Posted October 19, 2006 Share Posted October 19, 2006 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! Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/ Share on other sites More sharing options...
printf Posted October 19, 2006 Share Posted October 19, 2006 check if you have the extension installed...[code]<?phpinfo();?>[/code]me! Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111407 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 I just checked . . and it doesnt look like I have! What will I need to do to install it? Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111410 Share on other sites More sharing options...
printf Posted October 19, 2006 Share Posted October 19, 2006 OS type, (windows or Linux?)me! Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111418 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 Windows XP! Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111422 Share on other sites More sharing options...
craygo Posted October 19, 2006 Share Posted October 19, 2006 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'sRay Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111429 Share on other sites More sharing options...
printf Posted October 19, 2006 Share Posted October 19, 2006 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.dllextension=php_mysqli.dll[/code]Then restart IISAlso 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.htmlme! Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111430 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 Cheers guys but I am nearly sure I already un-commented them.. ill check Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111431 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 Yeah . . They are already un-commented! This is weird . . very strange Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111435 Share on other sites More sharing options...
craygo Posted October 19, 2006 Share Posted October 19, 2006 You can uncomment all you like but without the dll you get nothing. :)Ray Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111436 Share on other sites More sharing options...
craygo Posted October 19, 2006 Share Posted October 19, 2006 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.jpgAfter you have the extension in the directory you want you have to edit the php.in filechange the lines below. Make sure you put the paths in correctlyhttp://www.theelders.net/misc/phpini1.jpgAlso 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 inhttp://www.theelders.net/misc/phpini2.jpgOnce that is done restart your web server and should be all setRay Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111440 Share on other sites More sharing options...
Zane Posted October 19, 2006 Share Posted October 19, 2006 check out this thread http://www.phpfreaks.com/forums/index.php/topic,95376.0.html Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111442 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 . Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111443 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111446 Share on other sites More sharing options...
craygo Posted October 19, 2006 Share Posted October 19, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111450 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 Hi Ray, cheers for that...I ran it and didnt get the error this time and the echo printed "102" which is the last value in the database. The script still isnt working but at least i am not getting that message! Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111456 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 Thanks again everyone for your help . . much appriciated!! ;DRay taht code worked fine, I just have to make some modifications to it! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/24456-mysqli_result-undefined/#findComment-111457 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.