PHP - Check Mysqfields And Do Something If The Requirements Is The Same
Hello,
im having a table 'requirements' with rows - Age (17,18,19,20,21,22,23,24,25+) - Keeper (Number 1 - 20) - Playmaker (Number 1 - 20) - Scorer (Number 1 - 20) - Winger (Number 1 - 20) - Defender (Number 1 - 20) - id (1 for one country 2 for other country) I want to check when a player is in the age {Age row} and {id row} is the same and then check the rest of the fields if its the same or better than the number i have on mysql do something Thank you Similar TutorialsHey, To bypass having to write an entire script for it. Does anyone know of the location for a script to require age verification for a website. For example, before you enter alchohol websites it asks your age before you can proceed and so forth. For example: Quote http://www.captainmorgan.com/ If you know of a script somewhere that I can download and/or look at I would appreciate it! Thanks This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=307535.0 Hello, I have created a little voting script for my site. The insertion code into the MySQL databse when they vote is very simple: $ipaddress = addslashes($_POST['ipaddress']); $theid = addslashes($_POST['theid']); $gamert = addslashes($_POST['gamert']); $serveron = addslashes($_POST['serveron']); $db = mysql_connect("localhost", "username", "password"); mysql_select_db("thedb",$db); mysql_query ("INSERT INTO voting (theid,ipaddress,gamert,serveron2) VALUES ('$theid','$ipaddress','$gamert','$serveron') "); Obviously I only want them to be able to vote once. What is the best way to do a check of the IPs already in the database and check against theirs before submitting? Thanks. Suppose i have a table with around 10 entries in which one column contains the id and the second column contains a checkbox... If a checkbox a selected and the button (below the table) is pressed then i want to delete the columns corresponding the checked checkboxes.... I am not getting how sgould i pass the get variable on the link of the button??? -Pranshu Agrawal pranshu.a.11@gmail.com ok so i can get this to work so i want to check if there is a video on inside my db if there is no video and nothing happens but if there is i want it to echo video Code: [Select] <?php if($video == ""){ }else{ echo "VIDEO"; } ?> I am unable to execute mysql_num_rows properly in this program. Code: [Select] <?php $link=mysql_connect("localhost","root",""); $db = mysql_select_db("myDB",$link); $result = mysql_query("SELECT * FROM jobs WHERE jobType=abc"); $num = mysql_num_rows($result); echo "Found $num records"; ?> error is mysql_num_rows() expects parameter 1 to be resource Hello their, I'm wanting to use PHP to check to see if a username and password match a remote RDP server. The reason I ask is because I want to verify that the information the user is giving is correct. I'm looking though LDAP but I have no idea what I'm looking for. To recap, I would like to login to a RDP server and return a result based on if it completed. Thank-you for reading Paul P.S Sorry for the bad English, I seemed to forgot how to spell some words and have had to replace them with longer sentences Hi hello, Right now I have this generated URL: mywebsite.com/thisismypage?compare0=50&compare1=112&compare2=512 Is there anyway to "extract" the 50, 112, and 512 dynamically? Those numbers are the Item ID's, I need them for further operations. So is there a way to extract the IDs, maybe into an array? The ID's are dynamically rendered, as well as the "compare#". Not sure if I am being clear... hopefully this makes sense. All help is appreciated. Thank you. This is suppose to check a table to see if it has a value in it. I get this error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /homepages/6/d365637117/htdocs/EE Live/Active/Inc/session.php on line 33 This is the code if($checkProfile) { $result = mysql_query("SELECT prof_pic FROM members_profile WHERE id = '".$_SESSION['EEID']."'"); $mem_num_rows = mysql_num_rows($result); if($mem_num_rows =1) { } how do i echo "checked=checked" for a checkbox? here is what i have: Code: [Select] <input type='checkbox' name='ip_automatic_login' id='ip_automatic_login' value='1' if($IPCheck == true) {/"checked=checked/" } /> this code will be echoed! What is the best way to check for a Date in a Form? I see there is a CheckDate() function, but how does that know what format the Date is in? Should I use a Regular Expression? My Form Field is just a Text Box... Thanks, Debbie Currently I have an Input field for a "Written On Date". What is the best way to make sure a valid date is entered? Should I use Regular Expressions? Some PHP Date-Checking Function? Or switch to Drop-Down Lists to better control the selectable values? (Which won't catch things like June 31?!) Debbie Code: [Select] <table border="1"> <tr> <th>ID</th> <th>Image</th> </tr> <?php for($i=0; $i<=100; $i++) { $url = 'http://localhost/images/icon_'.$i.'_64x64.jpg'; echo "<tr><td>".$i."</td><td><img src='".$url."' /></td></tr>"; } ?> </table> So after testing this script, I get empty cells in the table if the image doesn't exist. Can someone show me how to make it display only the images that exists in that folder ? Hey guys, I've set up a database with a login and logout script for my site.. There is a TINYINT value called admin and it either equals 1 or 0 depending on whether the user is an admin or not.. The registration script works perfectly to create the table value and the login script works fine for the site.. The question I had was if I wanted to add a link to the bottom of every page that said: Go to Administration Panel and make it only viewable by ADMINS I figured this little script would work.. Here would be the end of the page: Code: [Select] <br /> <center>Copyright © 2010 <a href="http://www.website.com">www.WEBSITE.com</a></center> <?php include('includes/start_admincheck.php'); ?> <center><a href="<?php echo $homedir .'admin.php'; ?>">Go to Administration Panel</a></center> <?php include('includes/end_admincheck.php'); ?> </body> </html> Inside start_admincheck.php I have: (NOTE: $cUsername refers to a setcookie and $cAdmin does as well.. They are defined on my Variable page included at the top.) Code: [Select] <?php include('variables/variables.php'); ?> <?php mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error()); mysql_select_db("$mysql_database") or die(mysql_error()); if(isset($cUsername)) { $check = mysql_query("SELECT * FROM users WHERE username = '$cUsername'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if (($cAdmin == 1) && ($info['admin'] == 1)) { ?> And this is the end_admincheck.php Code: [Select] <?php include('variables/variables.php'); ?> <?php } else die(); } } else die(); ?> ?> I get this Parse error thrown at the bottom of the page: Code: [Select] Parse error: syntax error, unexpected $end in /*******/includes/start_admincheck.php on line 15 Naturally I would checkout line 15 in start_admincheck.php, but normally when I get an $end error it is the last line of the code and leaves me lost.. Something I'm missing guys? As always, thanks in advance Hello im trying to write a simple script so that before my website inserts an account into the database it checks to see if that email already exists. Heres what i got but it does not work. //script for checking if the email account already exists $CheckEmail = "SELECT * FROM Members WHERE email='".$email."'"; $EmailQuery = mysql_query($CheckEmail); $Emailresult = mysql_fetch_array($EmailQuery); $GotEmail = mysql_num_rows($EmailResult); if($GotEmail != 0) { $emailDup= "This email account has already been registered"; } else { //run the rest of my scripts later down the page I have this to echo the message <? if($GotEmail)==1 echo $emailDup; ?> Hey, I'm trying to check if a username is unique, but for some reason none of the methods that I've looked up seem to work. I'm aiming for the code to check if a username is unique, and if get the user to input the name again. $get = "SELECT `i` FROM `m` WHERE `i`=\"$r\""; $checkResults = mysql_query($getRandomness); while(mysql_num_row($checkResults) > 0) { //some code... //check again $get = "SELECT `i` FROM `m` WHERE `i`=$r"; $checkResults = mysql_query($get); } The error comes from the while line, but it comes up during the first check because the record is empty. This is the error: "Fatal error: Call to undefined function mysql_num_row()" I haven't coded in PHP for a while and I'm trying to refresh my memory on some things. =( I was hoping someone here could help me with a problem. I have a script I made to post articles to my database, one of the columns includes a number. 1 (yes) and 0 (no). Now i'm using this to keep track of what articles have been approved. When I edit an article I want to include a check box. If my database field contains 1 its checked... if its 0 then its not checked. how would I go about doing that? does anyone have code for checking to make sure an email address is typed in correct Hi.. So what i want to do is basicly to check if id XX exist in my database. How can this be done? Im thinking of something like: if(xx exist){do this} else{do this} Iv'e tried google etc before i posted here, but couldent really find anything where i found a soutable answer.. Hope someone can help! (: Hi , I have a login page that i acces via www.mydomain.com/logib.php?last_visited_page.php however the passed in variable last_visited_page.com is not always set . once the login script has run , when the variable it is not set i would want jump to myaccount.php otherwise jump to last_visited_page.php How do i check for no variable beinf present and therefore jump to myaccount.php Many Thanks Fraser |