machina12 Posted June 18, 2007 Share Posted June 18, 2007 Working on sql > php project. Am already using scripts and queries that allow for various functions. For example, some fields within database are: 'id','name','score','date' As I mentioned, I am already running if/then/else statements, but am wondering what is the best way to run multiple statements under one if statement? Am just running two duplicate lines of if statements with each different criteria, but wonder if there is a way to tighten up code. More importantly, I am wondering how to run simple evaluations within php. EX: if id='345' and score>200 then $query=good from here 1.) What is proper method for writing a multiple statement like this? 2.) How would I cross-evauluate values for a script? EX: if id='345' and score='200' and id='20' has score='150' $query=good from here It is just some of these multiple statements I need understanding. Any feedback would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/55987-managing-multiple-sql-statements/ Share on other sites More sharing options...
teng84 Posted June 18, 2007 Share Posted June 18, 2007 elaborate more and what exactly do you want to perform Quote Link to comment https://forums.phpfreaks.com/topic/55987-managing-multiple-sql-statements/#findComment-276539 Share on other sites More sharing options...
machina12 Posted June 18, 2007 Author Share Posted June 18, 2007 In question #1, I am wondering how to use a query that will only work if two values are correct. (figure doing 3 or more, will just follow the same method) So in this instance: if id='345' and score>200 then $query=good from here Within this question, I will end up INSERTing values into another database, which will store 'id' and '$score', so in this case I am mainly focused on the "and" statement, how should tag be written to allow for multiple values to be met? =============================================================================== In question #2, I am wondering how then use a query to cross-evaluate values, and only work if values meet criteria. So in this instance: If one players values meet one set of criteria, and anothers meet another, do something. EX: if id='345' and score='200' and id='20' has score='150' $query=good from here Again. then in a seprate database, I would like values to be stored, so it should be an INSERT query. I know how to do an insert command, but want to know how to give this evaultion a value, and another evaluation would have another value.... So how would I insert the given evaultion's value into the seperate database...with only player id and cross-evaluation value. EX: columns: 'id' 'crossevaluationA' Proper Tags? This is it in a nutshell! Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/55987-managing-multiple-sql-statements/#findComment-276809 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.