Cless Posted July 10, 2007 Share Posted July 10, 2007 Hello, I have two questions. The first one is, how do you add two variables together? Not string variables (ones with words), but variables using numbers. So, if $Int1= 4, and $Int2= 3, I want to add those up to make them 7 (4+3=7). I used to know, however, I forgot. Is it $Int1+$Int2; ? Second question. How could you, erm, in a mysql select function, make a second condition in the where part? Um, that is obviously confusing. Here. So, $Result= mysql_query("SELECT * FROM $Table WHERE Username='$_POST['Username']'") Yes. That would find your username from whatever specified table, or whatever. However. let's say you allowed people to have the same names, which no one would do, nor am I, however, I am using the normal User information stuff to show you examples and stuff. Anyways, let's say you allowed people to have the same names, but they had to have different genders... So, if two users had the name "Fool" XD, but their genders were not the same... how could you select the user info, then? Like... allowing the where to have two conditions. $Result= mysql_query("SELECT * FROM $Table WHERE Username='$_POST['Username']'") How could that also use WHERE Gender='$_POST['Gender']? This obviously wouldn't work... $Result= mysql_query("SELECT * FROM $Table WHERE Username='$_POST['Username']' WHERE Gender='$_POST['Gender']'") So... it would have two conditions. :S God, that was SERIOUSLY confusing... Sorry if you couldn't understand. Thanks. Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 10, 2007 Share Posted July 10, 2007 dont want to read long story sorry $sum=$x+$y; you can have this Username='{$_POST['Username']}' or Username=".$_POST['Username']." Quote Link to comment Share on other sites More sharing options...
Cless Posted July 10, 2007 Author Share Posted July 10, 2007 $sum=$x+$y; Oh, I see. Thanks! you can have this Username='{$_POST['Username']}' or Username=".$_POST['Username']." Wha--? o.o I don't get it. xD I don't see what you're talking about... I already know how to find usernames using POST and such, lol. Quote Link to comment Share on other sites More sharing options...
Carterhost Posted July 10, 2007 Share Posted July 10, 2007 In answer to the second question: yes. $Result= mysql_query("SELECT * FROM $Table WHERE Username='$_POST['Username']' AND Gender='$_POST['Gender']'") Or: $Result= mysql_query("SELECT * FROM $Table WHERE Username='$_POST['Username']' OR Gender='$_POST['Gender']'") Quote Link to comment Share on other sites More sharing options...
Cless Posted July 10, 2007 Author Share Posted July 10, 2007 I KNEW it had something to do with AND. Lol. Thanks, guys! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.