Jump to content

PM System Question


Guteman

Recommended Posts

Hey All,

Im in the middle of creating a private messanging system for my client system, but I have hit an issue. Here is my problem, I have a form and one of the fields is "recipient." Now, what im trying todo is to make sure the recipient(pm) =  login(client). This is what I tried todo.

[code]$checkname = mysql_query("SELECT login FROM clients WHERE login");
$checkname= mysql_fetch_array($checkname);[/code]

[code]else if($checkname != $_POST['recipient'])
{
$error_message .= '<p class="failure">Error: Username does not exist.</p>';
}[/code]

its not working, I think its a problem with my mysql query, can someone help?

Thanks,
Paul G.
Link to comment
Share on other sites

Let me clarify... I tried this, but still nothing

[code]$checkname = mysql_query("SELECT login FROM clients WHERE login='$_POST[recipient]'");
$checkname= mysql_fetch_array($checkname);

if(strlen($_POST['recipient']) <= 0)
{
$error_message .= '<p class="failure">Error: You did not enter a Recipient.</p>';
}

else if($checkname != $_POST['recipient'])
{
$error_message .= '<p class="failure">Error: Username does not exist.</p>';
}[/code]

I knew it was the while, but I cant figure out what to use.
Link to comment
Share on other sites

sorry for spam

Let me use an example

I want to send a message to Guteman, one of my clients. I want to make sure I typed in the right name before the message is sent, or it sends an $error_message.

I want $checkname to become Guteman or any other client I have.

I meant WHERE not while, sorry
Link to comment
Share on other sites

can you change
[code]$checkname = mysql_query("SELECT login FROM clients WHERE login='$_POST[recipient]'"); [/code]
to
[code]$checkname = mysql_query("SELECT login FROM clients WHERE login='$_POST[recipient]'") or die ("MySQL query error."); [/code]
?

That way we know wether or not the query is executing
Link to comment
Share on other sites

[quote author=nethnet link=topic=102936.msg409311#msg409311 date=1154661065]
$checkname is an array, yet you are treating it as a string in your if statement.  Add a key called 'login' to it.

[code]$checkname['login'][/code]
[/quote]

Hehe I always try to help but I'm never the one who sees the real problem :P
Link to comment
Share on other sites

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.