MySQL-无法跳转到MySQL结果索引的第0行 [英] MySQL- Unable to jump to row 0 on MySQL result index
问题描述
我有一个旧网站,最近显示一个错误,这是奇怪的,因为它一直没有改变一段时间。我得到以下结果:
无法跳转到MySQL结果索引8的第0行
这是什么原因,我该如何解决?
PHP / MySQL网站。
解决方案如果我记得正确,这个错误通常来自一个代码段,如下:
//你可能有一些类似这样的代码
$ var = mysql_result($ result,0,'column_name');
其中查询失败或列不存在。检查
$ result
是一个有效的MySQL资源,以确保SQL是有效的,然后确保实际上从数据库获取结果,然后尝试调用mysql_result
。
或者更好的是使用
mysql_fetch_array
获取每个列值(如果您有多个从查询返回的列)。I have got an old site that has recently been displaying an error which is weird as its been untouched for some time. I get the following:
Unable to jump to row 0 on MySQL result index 8
What is the cause of this and how should I fix it?
It is a PHP/MySQL site.
解决方案If I remember correctly, this error typically stems from a code segment like the following:
// You probably have some code similar to this $var = mysql_result( $result, 0, 'column_name');
Where either the query fails or the column doesn't exist. Check that
$result
is a valid MySQL resource to make sure that the SQL is valid, then make sure you're actually getting results from the database before trying to callmysql_result
.Or, better yet, using
mysql_fetch_array
instead of manually fetching every column value (if you have multiple columns returned from the query).这篇关于MySQL-无法跳转到MySQL结果索引的第0行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!