Jump to content

Barand

Moderators
  • Posts

    24,602
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. Syntax for IN is a comma-separated list eg IN (1,2,3) It looks like your $var_hook is an array, so $id_list = join(',', $var_hook); then use IN ($id_list)
  2. This thread should help http://forums.phpfreaks.com/topic/277085-the-eav-model-or-something-better/
  3. See forum FAQ http://forums.phpfreaks.com/index.php?showtopic=273121
  4. Sean Murray has 32 yes/no values so there is not a consistent pattern edit: Also fran and roxy have single-word names
  5. try echo "<option value=\"{$row['csname']}\">{$row['csname']}</option>";
  6. See "MySQL Table aliases". Most of the time they are an optional convenience but in some cases they are essential.
  7. see this site's FAQ http://forums.phpfreaks.com/index.php?showtopic=273121
  8. The problem with resizing on the client, either HTML or CSS, is that you are still downloading the full-size image which takes time. If I'm going to require thumbnails I prefer to create them on upload then they are available for speedy download and display.
  9. To find records in votes with no matching poll_id in user_votes use a left join. SELECT v.* FROM votes v LEFT JOIN user_votes uv ON v.poll_id = uv.vote_poll_id WHERE v.user_id = 1 AND uv.vote_poll_id IS NULL
  10. What gets updated when a user votes?
  11. perhaps @VAL := LAST_INSERT_ID(); INSERT INTO `otherTb` (user_id, `instance_id`, `category_id`,) VALUES (@VAL, NULL, 04);
  12. which of those 2 tables, votes or user_votes, does NOT have a poll_id until the user votes?
  13. All 3 of them
  14. 1 You need all the items being voted on so you know which are missing 2. You need all users so you know who has not voted 3. You need which user voted for which item
  15. To do this you need 3 tables voter : voterid | voter item : itemid | item votes : itemid | voterid Create a cartesian join between voter and item to get all combinations then left join with votes to see which combinations are missing
  16. what do your tables look like?
  17. Nothing changes! How are you doing?
  18. As I said, it worked fine for me, but then I was using my own test data files. Attach your data files and I see if it makes a difference.
  19. There is an excellent class you can download called "AdLDAP". I used it all the time for AD applications
  20. That final ORDER BY should be GROUP BY. Guess you spotted that.
  21. try SELECT date, aname, SUM(total_leads) as total FROM ( SELECT DATE(l.time1) as date,a.affid,a.aname, COUNT(l.reqid) as total_leads FROM leads l LEFT JOIN affiliates AS a ON l.affid = a.affid LEFT JOIN campaign AS c ON l.campid = c.campid WHERE (a.affid = l.affid) GROUP BY DATE(l.time1),a.aname UNION ALL SELECT DATE(x.extstamp) as date,a.affid,a.aname, COUNT(x.reqid) as total_leads FROM ext_leads x LEFT JOIN clicks AS cl ON cl.reqid = x.reqid LEFT JOIN affiliates AS a ON a.affid = cl.affid_sid WHERE (cl.reqid = x.reqid) GROUP BY DATE(x.extstamp),a.aname ) as sub ORDER BY date, aname
  22. try $db = mysqli_connect(HOST, USERNAME, PASSWORD, DATABASE); // connect to database $costSql = 'SELECT sum(amount) FROM costs'; // define the query $result = mysqli_query($db, $costSql); // execute the query $row = mysqli_fetch_row($result); // get return row $costs = $row[0]; // get the total $donationsSql = 'SELECT sum(amount) FROM donations'; // define the query $result = mysqli_query($db, $donationsSql); // execute the query $row = mysqli_fetch_row($result); // get return row $donations = $row[0]; // get the total $result = $donations - $costs;
  23. Your example used commas as separators in the CSV, you are now using semicolons.
  24. Did you allow for mine opening "input.txt" and writing to "output.txt"?
×
×
  • 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.