Closed (fixed)
Project:
Drupal core
Version:
6.9
Component:
database system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 May 2009 at 21:02 UTC
Updated:
20 Sep 2011 at 20:19 UTC
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
Comment #1
devin carlson commentedThe 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.