I just want to escape-disabling the create-form to appear at the user when he've already submit contest at this content type and the specific taxonomy term.
e.g
I want to create a submit to contest content type.I want the query only from the database ( i dont care if i use the schema or not ) in order not having double posts at the same contest from the same user.
So if it was a simple mysql-query at a custom cms it could be like this

$query="select * from posts where taxonomy_term=$term and user=$current_user";
$result = mysql_query($query);
if(mysql_num_rows($result)>0){
echo "U've already post at this contest.Sorry next time";
}else{
//Continue with drupal code
}

THanx!

Comments

devin carlson’s picture

Component: node system » database system
Category: task » support
Status: Active » Closed (fixed)

The example you provided looks all right.

If you want to follow best practices, you should adapt your query to use the db_query function.

For more information on working with the database, check out the database access documentation page.