It's something simple... I think but I'm not advanced enough in php to do it ): And I don't have money to pay someone to do it either ): I need to limit users from adding dragons that have less then 3 days to live. My site is a fansite based on dragcave.net. If anyone can help me I'd really appreciate it
Pardon me for not completely understanding the question, but you could add something as simple as this if statement: Please note you'll have to change the database settings obviously as well as the vars and database data. I am not sure how you plan on looking up the dragon (is it within the user's account? In a drop down? or something? ID would be most efficient but in this example I'm going to search by name.) PM me if you need more help. <?php // My assumption is you're using sessions for users? session_start(); // Basic MySQL connection unless you have a class/function for it mysql_connect("localhost","USER","PASS"); mysql_select_db("USER_DATABASE"); // Provided that you're using sessions and the dragon name was posted through a user input $query = mysql_query("SELECT * from users WHERE user='".mysql_escape_string($_SESSION['username'])."' AND dragon_name='".mysql_escape_string($_POST['dragon_name'])."' LIMIT 1;"); while($row == mysql_fetch_array($query)){ // Assuming your "lives_remaining" column is where the lives are stored $lives = stripslashes($row['lives_remaining']); } if($lives < 3){ echo("Your dragon must have at least 3 days left to live to be added."); exit; } ?> PHP: Again difficult without knowing the exact situation of everything but that is an example of what you could do! Regards, Dennis M.
if ($dragons < $three_days_to_live) { limit_dragons() } Code (markup): sorry...I had to do that ;-) great idea for a script!