Jump to content

machina12

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

machina12's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 Within this question, I am wondering how to have a few fields being analyzed, and if criteris is met, and only if met, put a value within new database as well as new id tag for this cross-evaluation....that way records can be tracked later. BASICALLY HOW TO CODE FIRST PART CORRECTLY, ANY HELP WITH QUERY SUGGESTIONS IS APPRECIATED TOO. So how would I insert the given evaultion's value into the seperate database...with only player id and cross-evaluation value? EX: columns would be: 'id' 'crossevaluationA' The id would be possibly a combo of users id's, so id 001 and id 002 ineract, it places a new id 001002 and value for interection...could start with 001. Proper Tags? This is it in a nutshell! Any help is appreciated.
  2. 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.
  3. 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.
  4. Caesar, I appreciate the help, first recommendation that showed a result. I was able to show one users data, but had to use something other than: SELECT id , score FROM testdata WHERE id = 1 LIMIT 0, 2; Almost like commands score < 300 don't work....or id < 30 ...or id = 30 Should there be 'marks like these around fields'....or "quotations"? Getting calculations to work is one thing. What about multiple rows of this data? Think suma237 might have been in this direction. For example....SELECT all users with score < x and place all there information (id #, name, score, date) In row format...using your $result[0]$result[1]$result[2]$result[3]$result[4] Method. Just want a next row for next users data ex: $result[a]$result[a1]$result[a2]$result[a3]$result[a4]
  5. Trying to have an echo display a result from a query. Not such a hard concept. Yet I am having trouble. What good is the data without analysis. Here is what I am using to try and grab result. Have been told it looks correct, must be missing something small. When this runs, alternate echo displays in browser. So you know: 'testdata' is the table 'score' & 'id' are columns or fields. Almost think it is missing a table structure to display in. Looking for player name column and score column (for the sake of example). <? $name = $_GET['name']; $score = $_GET['score']; $dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("database"); if ($score > 0) { $query = 'SELECT `id` , `score` FROM `testdata` WHERE id = 1 LIMIT 0, 2 '; $result = mysql_query('SELECT `id` , `score` FROM `testdata` WHERE id = 1 LIMIT 0, 2 '); echo mysql_result($result, 2); } else { echo('No score was submitted'); } ?> ================= This is what phpmyadmin says is correct php code for sql query? ================= $sql = 'SELECT `id` , `score` FROM `testdata` WHERE id = 1 LIMIT 0, 2 '; ======================================================== Would appreciate any feedback that will help me get to my next step.
×
×
  • 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.