Jump to content

Recommended Posts

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.
Link to comment
https://forums.phpfreaks.com/topic/32395-if-and-while-loop-issue/
Share on other sites

[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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.