MySQL Forums
Forum List  »  Quality Assurance

Mysql member account types confusion
Posted by: Josh Adan
Date: March 10, 2012 11:40AM

Hi I am trying to create a membership website where only members with certain specific account types can send a private message. The table that contains the members details is "mymembers" and there is a column called "account_types" that defines the account types of members as "a" "b" and "c". The default is value "a" but I want only members with account types "b" and "c" to send private messages to other members. I will be very grateful to anyone who helps me.

Below is how members who send 30 messages within a day are prevented from sending any more. I am finding it very difficult to query the database for the sender's account type and if it is "a" , prevent him from sending the message.

$checkuserid = $_POST['senderID'];
$sql = mysql_query("SELECT id FROM private_messages WHERE from_id='$checkuserid' AND DATE(time_sent) = DATE(NOW()) LIMIT 40");
$numRows = mysql_num_rows($sql);
if ($numRows > 30) {
echo '<img src="images/round_error.png" alt="Error" width="31" height="30" /> You can only send 30 Private Messages per day.';
exit();
}


The table "private_messages" is where all private messages and information on them are stored. "from_id" is the column that stores the id of the sender which is the same as the unique id a member gets when he joins the site which is also in the "mymembers" table as "id". "to_id" is the column that stores the receiver's unique member id while "from_id" stores the sender's. The id column in "private_messages table identifies the private message and stores it giving it a unique id. I am finding it very difficult to query the database for the sender's account type and if it is "a" , prevent him from sending the message. The receiver's account types could be any. I will be very grateful to anyone who helps me. If you need more information please feel free to ask. Thanks a lot.

Options: ReplyQuote


Subject
Views
Written By
Posted
Mysql member account types confusion
2243
March 10, 2012 11:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.