Link to home
Start Free TrialLog in
Avatar of n8dog
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_blogcommentsn,0,"users.username");


better approach?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of n8dog
n8dog

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?
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 ,
Avatar of n8dog

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_blogcommentsn, 0 ,"users.username");  // NOTE: the 0 in place $counter
if ($sql_blogcommentsn = mysql_query($sql))
{
   if ( $row = mysql_fetch_assoc($sql_blogcommentsn))
   {
       $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?
Avatar of n8dog

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...
Avatar of n8dog

ASKER

you're 100% correct.. i wanted to feel lazy for a moment.. ok, the moment is over :)

-n