n8dog
asked on
Warning: SQL cant jump to...
is this warning a big deal?
ive been writting a few things where i have it jump directly to row 0...
is that bad?
example: $ownerscreenname = mysql_result($sql_blogcomm entsn,0,"u sers.usern ame");
better approach?
ive been writting a few things where i have it jump directly to row 0...
is that bad?
example: $ownerscreenname = mysql_result($sql_blogcomm
better approach?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
well, I never tried it, as I avoided that function from the beginning on...
the gains should be subsecond usually, so only be important when the page would suffer from heavy traffic.
now, mysql_result can of course be used, for example when you have queries like "select count(*) from ... " where indeed you only need to fetch a single row/column.
to come back to the actual "warning". it should not be ignored, because probably it means you have an issue.
it could be that the query returned no rows at all, or you are trying to run the function several times at once in 1 line of code ,
the gains should be subsecond usually, so only be important when the page would suffer from heavy traffic.
now, mysql_result can of course be used, for example when you have queries like "select count(*) from ... " where indeed you only need to fetch a single row/column.
to come back to the actual "warning". it should not be ignored, because probably it means you have an issue.
it could be that the query returned no rows at all, or you are trying to run the function several times at once in 1 line of code ,
ASKER
well for instance when im looking up a particular record, just indentify it directly, knowing that i will only get 1 row back..
so then i use $ownerscreenname = mysql_result($sql_blogcomm
if ($sql_blogcommentsn = mysql_query($sql))
{
if ( $row = mysql_fetch_assoc($sql_blo gcommentsn ))
{
$ownerscreenname = $row["username"];
}
}
now again:
* dont use the table name when getting the field value!
* are you sure that there is 1 row all the time?
{
if ( $row = mysql_fetch_assoc($sql_blo
{
$ownerscreenname = $row["username"];
}
}
now again:
* dont use the table name when getting the field value!
* are you sure that there is 1 row all the time?
ASKER
well, i should probably upgrade my method of working with it then, yes?
my errorlogs are filled with TONS of warnings regarding this.. with my users using the blogs, forums, etc.. they get hit pretty often. thus creating this..
although i guess i could turn off warnings too...
>although i guess i could turn off warnings too...
that's of course the lazy method... just hiding all the potential other issues...
that's of course the lazy method... just hiding all the potential other issues...
ASKER
you're 100% correct.. i wanted to feel lazy for a moment.. ok, the moment is over :)
-n
-n
ASKER
jeez, i use that manner of accessing all of my database stuff... and the site im working on its 100% db based..
woops!
what level of speed difference are we talking about here?