Pyro4816 Posted December 31, 2006 Share Posted December 31, 2006 It's kinda hard to explain the problem so i will show you.[code] $result = $connector->query("SELECT * FROM messages WHERE two='".$_SESSION['username']."' AND rd='0'"); $result2 = $connector->query("SELECT * FROM messages WHERE two='".$_SESSION['username']."' AND rd='0'"); $row9 = $connector->fetchArray($result2); if ($row9['ID'] != ""){ echo '<b>RECEIVED</b><br /><table><tr><td>Title</td><td>From</td><td>Status</td></tr>'; while ($row = $connector->fetchArray($result)){[/code]basically the issue is by the time i make it to the while loop i have moved on to the second result and on, i solved it by doing the same query twice and making to different "rows" is there a way to get my desired effect in one query?All i really need is an if statement that can determine if the query is empty or not, any ideas?ALSO, i have ben having a ton of problems with case sensitivity in databases, is there any way to fix that, like ill request items for Pyro and it returns things for Pyro and pyro but the system i am using is like [code]if (name == $name){}[/code]where name is from the database and $name is a session, like it will only display is the two match exactly like:Pyro = Pyro but if it is Pyro = pyro it errors. Quote Link to comment https://forums.phpfreaks.com/topic/32395-if-and-while-loop-issue/ Share on other sites More sharing options...
.josh Posted December 31, 2006 Share Posted December 31, 2006 [url=http://www.php.net/mysql_data_seek]mysql_data_seek()[/url] Quote Link to comment https://forums.phpfreaks.com/topic/32395-if-and-while-loop-issue/#findComment-150439 Share on other sites More sharing options...
Pyro4816 Posted December 31, 2006 Author Share Posted December 31, 2006 well that solved my main problem, now i just need to fix the case sensitive thing Quote Link to comment https://forums.phpfreaks.com/topic/32395-if-and-while-loop-issue/#findComment-150460 Share on other sites More sharing options...
wildteen88 Posted December 31, 2006 Share Posted December 31, 2006 [quote]ALSO, i have ben having a ton of problems with case sensitivity in databases, is there any way to fix that, like ill request items for Pyro and it returns things for Pyro and pyro but the system i am using is like [code]if (name == $name){}[/code]where name is from the database and $name is a session, like it will only display is the two match exactly like:Pyro = Pyro but if it is Pyro = pyro it errors.[/quote]Use the identical operator === instead. This will then make the comparison case sensitive. Quote Link to comment https://forums.phpfreaks.com/topic/32395-if-and-while-loop-issue/#findComment-150462 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.