Jump to content

Recommended Posts

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.

 

     

 

 

Link to comment
https://forums.phpfreaks.com/topic/55987-managing-multiple-sql-statements/
Share on other sites

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.