jjacquay712 Posted September 7, 2008 Share Posted September 7, 2008 Ok.... this one is really simple but i don't know what to do. When i do a query like this: $resource = mysql_query("whatever"); $result = mysql_result($resource, 0, 'username'); and it doesn't get a result it displays this error: Warning: mysql_result(): supplied argument is not a valid MySQL result resource. how do i do it, so that if it doesn't find anything, it doesn't give an error? and $result == ""; Link to comment https://forums.phpfreaks.com/topic/123179-solved-mysql-errors/ Share on other sites More sharing options...
DarkWater Posted September 7, 2008 Share Posted September 7, 2008 It means the query was invalid, not that it returned no rows. You should add (albeit rudimentary) error checking to your query: $resource = mysql_query("whatever") OR die(mysql_error()); Also, don't use mysql_result(). Link to comment https://forums.phpfreaks.com/topic/123179-solved-mysql-errors/#findComment-636179 Share on other sites More sharing options...
jjacquay712 Posted September 7, 2008 Author Share Posted September 7, 2008 i cant echo a mysql_query(), i need to echo the data Link to comment https://forums.phpfreaks.com/topic/123179-solved-mysql-errors/#findComment-636180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.