Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. For those reading along here is my final query: $q = "update tms_test_matchdata p join (select m.* from tms_test_matchdata m where m.Tourn_key='$tourn_key' and m.Printed IS NULL) s on p.Tourn_key=s.Tourn_key and p.Eventcode=s.Eventcode and p.MatchId=s.MatchId set p.Printed='Y'"; Note the placement of the set clause.
  2. Well, I'll be! That worked. Odd - that putting the set at the end made all the difference.
  3. Re: your last As I said earlier I don't know that a huge IN() list would be acceptable. It could have 200+ entries in it.
  4. This is what I'm trying now. <? $q = "update tms_test_matchdata p set p.Printed='Y' join (select m.* from tms_test_matchdata m where m.Tourn_key='$tourn_key' and m.Printed is null) s on p.Tourn_key=s.Tourn_key and p.Eventcode=s.Eventcode and p.MatchId=s.MatchId"; ?> The error I get is check the manual that corresponds to your MySQL server version for the right syntax to use near 'join (select m.* from tms_test_matchdata m where m.Tourn_key='TMStest' and ' at line 2
  5. No they don't. The FldA and FldB that I mention are unique as a combination though.
  6. Let me add some more info to my problem. My data is involved with the game of handball and is the match data for a tournament. FldA represents the event code for the match of which there are many. FldB represents a unique match id for an event code. There can be many similar match ids but NOT within an event. For ex., FldA can be MB, MC or MO. FldB can be R1S0108, R1S0207, R1S0304, etc. These values can exist in every single event, BUT for a specific event only once. My select query has pulled a set of matches (records) that match some criteria and after I have finished using that data I want to go back and post something in one of my tables for every record that was selected and processed. So I want to run an Update query without having to re-generate this huge query again (there are 8 tables in it and there can be upwards of 200 rows in the result). I could re-write the query to only cull out the bare minimum (but essential) data which would use only one table, but I still don't know how to get my update to affect only each of the records in that select query Something like this: update match_table a set printed ="Y" join (select eventcode,matchid from match_table where eventcode='MO' ) b on a.eventcode = b.eventcode and a.matchid = b.matchid is what I'm thinking. Can anyone confirm that this would work?
  7. All three fields are in the same table. My update will only affect one table. The question is - how do I make my update query only update those having the following pseudo-where clause: "update my_table set FldC='x' where (FldA='vala1' and FldB='valb1') OR (FldA='vala2' and FldB='valb2') OR (FldA='vala3' and FldB='valb3') OR (FldA='vala4' and FldB='valb4') .... where my values for FldA and FldB come from the results of a previously generated select query. I could actually create the above query using php but the 'where' clause could be posting 200 records and my thought is that would be one hellaciously long query statement for the server.
  8. As the title indicates, a tricky query problem. I have a set of query results that contain two unique criteria that I would like to use in a second query to update a third field. For ex. My select query yields among other things a FldA and FldB on each record. These are not unique themselves, but as a combination they will select a unique record (Key!!). I would like to take this set of fields and perform an update on a single table where the records to be updated (updating 'FldC') match the FldA and FldB pairs. I have seen many examples but none seem to fit my case, or else I don't understand this fully. Thanks in advance!
  9. Just upgraded my phone to ios 6 and surprise! My web apps utilize the 'type=number' attribute on input tags to trigger the numeric keypad on the iphone of course. They also use the 'size=n' attribute to re-size the input tag to an appropriate width. Well with ios 6 installed my size= values are being ignored. All my input tags are a standard size now and I haven't found anything online to tell me how to correct this issue. Has anyone been using this upgrade long enough to have solved this issue?
  10. You know - you are absolutely correct. I'm going to leave this site. Too frustrated by the caliber of people's attitudes towards teaching themselves something instead of seeking work done by others. Thought I could be of help here, but instead my own principles have made me come across badly here. This topic exemplifies that totally. I apologize to those reading this topic for my off-the-cuff response here. (Can you believe I was a math major 40 years ago?) Good luck to all you newbies.
  11. Add another row to your table, output a '&nbsp' character to all the td elements except where you want to the total, then close the row and the table.
  12. Have you ever programmed before? Use those skills here. You're looping thru all of your results. Accumulate what you need. Then output it at the end of your loop.
  13. Read up in the manual about the while function. After doing a query it is usual to do: while ($row = mysqli_query($myqry)) { do stuff with $row['???']...... }
  14. I don't see any code where you tried to do that sum. You also did a nice job of error checking your connection, but what about your query itself? Bad practice...
  15. You can't do a '+=' operation on something that hasn't been created yet. You should also check that balance is not null before trying to include it. You should re-think your algorithm. You are outputting your file on each and every pass thru the loop. Wasteful. Do it after your loop completes.
  16. Suppose I have to also add: after dumping your query results to 4 arrays - one for each column's contents.
  17. Nested for loops. Look it up. Can't imagine why you would want to do this tho
  18. For this exercise, this has to be a right triangle, correct? Therefore the other two angles have to be 30 & 60. Take it from there. And find a 10th grade math forum for more help
  19. Always do error checking. Your query statement is flawed. If you had checked your query results and displayed MySQL_error you would have caught the error before trying to process an non-existent result. (In case you didn't notice that Neil corrected your query.)
  20. Advice for newbies: Look up the syntax and usage of any function before you implement it. It will save you TIME and FRUSTRATION. (Note: the url to the php manual ("the bible") is at the top of this forum.) For functions that return a value, be sure to check that the value doesn't indicate an error (ESPECIALLY queries!) before you try to use your expected results. It's great that you are intrigued and excited about learning php, but the big part of getting into this is Learning and you won't do that if you don't do some work.
  21. You could start by showing the new message and also the line that it points to
  22. Do this: echo "About to send email to $to <br>subject $subject <br>message <br>$message <br>with headers of $header"; if (mail($to,$subject,$message,$header)) echo "Executed mail statement successfully"; else echo "Mail returned false";
  23. HTH in giving a kick-start. Be sure to mark this answered.
  24. Don't see anything wrong personally. But you aren't doing any error checking in your code - you really should. so you have this in your header: error_reporting(E_ALL | E_STRICT); ini_set('display_errors', '1'); (just checking).
×
×
  • 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.