Jump to content

Barand

Moderators
  • Posts

    24,565
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. What filtering are you doing in the PHP function?
  2. You need to specify the earlier date of the range first (BETWEEN earlier AND later) You can do it entirely in the SQL WHERE dob BETWEEN CURDATE() - INTERVAL 99 YEAR AND CURDATE() - INTERVAL 18 YEAR
  3. I've changed the join condition for pm2 SELECT DISTINCT pm1.meta_value AS 'ORDER No' , pm1.post_id AS 'TICKET No' , pm2.meta_value AS 'Guest Name' FROM $wpdb->postmeta pm INNER JOIN $wpdb->postmeta pm1 ON pm.post_id = pm1.post_id AND pm1.meta_key = '_tribe_wooticket_order' INNER JOIN $wpdb->postmeta pm2 ON pm1.meta_value = pm2.post_id AND pm2.meta_key LIKE '% Attendee Name' WHERE pm.meta_key = '_tribe_wooticket_event' AND pm.meta_value = 263;
  4. What a mess! Sometimes the meta_value is the OrderNo, at other times the postID is the OrderNo. Then you need to match postID, which looks like an INT field, with integer values held in a char field. Ugh!
  5. It would help if you posted some sample data so we can see what it looks like and help us navigate those meta-keys and meta-value fields
  6. I think it should be something like this SELECT pm1.meta_value AS 'ORDER No' , pm1.post_id AS 'TICKET No' , pm2.meta_value AS 'Guest Name' FROM $wpdb->postmeta pm INNER JOIN $wpdb->postmeta pm1 ON pm.post_id = pm1.post_id AND pm1.meta_key = '_tribe_wooticket_order' INNER JOIN $wpdb->postmeta pm2 ON pm.post_id = pm2.post_id AND pm2.meta_key LIKE '% Attendee Name' WHERE pm.meta_key = '_tribe_wooticket_event' AND pm.meta_value = 263 LIMIT 0 , 30
  7. Don't put the quotes around column names - SQL will treat them as strings. SELECT price, costs, cargodamage, price - costs - cargodamage as profit FROM drive_routes
  8. I agree with ginerjm's basic tenet except I wouldn't restrict the advice to same table only. For example you wouldn't store a total when the total can be got by SUMming a related table. Don't store data that is derived from other data.
  9. Select the four categories that you want to list in your query. For example SELECT ... WHERE catID IN (1,3,5,6)
  10. in this code is the "2" the 2 rooms you mentioned? If that is the case then your code isn't good even for 2 rooms.
  11. Don't hijack other peoples posts.
  12. You are not posting anything that has the name "Submit" so $_POST['Submit'] is never set.
  13. I use $res = $mysqli->query("SELECT COUNT(*) FROM table"); list($count) = $res->fetch_row();
  14. I wasn't aware bind_result() could have "?" placeholders
  15. You could introduce a couple of new search types into your array gte (greater than or equal to) lte (less than or equal to
  16. Just curious, Psycho, but would would you use the same argument in (2) above when it comes to using prepared statements and bind_result()?
  17. Storing in the database as you do now is the correct way. Format the date as required on output using the code blacknight provided ($date in his code would be your date field from the database record). Alternatively, you can format the date in your sql query using the mysql function DATE_FORMAT http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_date-format
  18. Which is a case-study in why you should not stored derived data (like totals) in tables as it can easily get out of sync. You should always query the original data to get the total. Just my 0.02 worth.
  19. Now we see why you're using arrays - your data is stored like a spreadsheet. Does "normalization" mean anything to you?
  20. You also need to look at how to upload a file. http://php.net/manual/en/features.file-upload.post-method.php
  21. Do you want us to use our crystal balls and tell you which column names you should be using instead of the ones you are currently storing in the array?
  22. Not much I can add to Gizmola's reply and I don't know how your application is processing the table. If you find a lot of the scores in each record are unused, or only one score is updated at any one, time then instead of +--------+-----+-----+-----+--------+--------+-----+---------+ | userid | X | Y | Z | score1 | score2 | ... | score90 | +--------+-----+-----+-----+--------+--------+-----+---------+ you could consider putting the used scores in a separate table, one score per row USER TABLE +--------+-----+-----+-----+ | userid | X | Y | Z | +--------+-----+-----+-----+ | | +----------------+ | | SCORE TABLE +---------+---------+---------+ | userid | scoreid | score | +---------+---------+---------+
  23. I found the ADLDAP class a great help when working on intranets with active directory https://github.com/adldap/adLDAP
  24. You need ($hours + $minutes/60) * $pay
  25. cyberRobot - How do you, or any of us, know what will be of use when we don't know how s/he is storing the data?
×
×
  • 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.