Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


mikosiko last won the day on August 8 2014

mikosiko had the most liked content!

Profile Information

  • Gender
    Not Telling

mikosiko's Achievements


Newbie (1/5)



  1. with different aliases x.uname, y.uname, z.uname; matching the aliases used for JOINing the table users... in your case you should have x.firstname, x.lastname, y.firstname, y.lastname, z.firstname, z.lastname
  2. here is the mock-up of a possible solution (tested)... replace/add your table field names and aliases SELECT a.uid, x.uname, a.fid, y.uname, b.fid, z.uname FROM partners a JOIN partners b ON a.fid = b.uid AND b.fid NOT IN ( SELECT m.fid FROM partners m JOIN partners n ON m.fid = n.uid WHERE m.uid =1) JOIN users x ON a.uid = x.uid JOIN users y ON a.fid = y.uid JOIN users z ON b.fid = z.uid WHERE a.uid =1; Note: uid = user_id uname = users.firstname or users.lastname // add fields as you need fid = friend_id The output of that query (using your data as example) is this 1, 'Jason', 2, 'Chelsea', 6, 'Jim' 1, 'Jason', 2, 'Chelsea', 12, 'Peter' 1, 'Jason', 2, 'Chelsea', 12, 'Cameron' 1, 'Jason', 2, 'Chelsea', 38, 'Felicia' 1, 'Jason', 4, 'Davey', 14, 'Jeffrey' 1, 'Jason', 5, 'Adam', 6, 'Jim' 1, 'Jason', 5, 'Adam', 14, 'Jeffrey' 1, 'Jason', 5, 'Adam', 17, 'Dan' 1, 'Jason', 20, 'Victor', 1, 'Jason' the last record (yourself) could be eliminated easily adding the condition to the last where
  3. some comment added if (isset($_POST['close'])){ $idList = array_keys($_POST['close']); $idList = array_map('intval', $idList); $implValue = implode(',', $idList); $closequery = "UPDATE sellerinfo SET Closed='y' WHERE Index IN ($implValue)"; // Here you echo your raw query to validate if it is well formed and syntactically correct echo "The query is : " . $closequery . "<br/>". // Here you add a basic error control to trap any error during the query execution // die should be replaced for something better while code is in production.. like trigger_error per example mysql_query($closequery) or die("Query Error : " . mysql_error()); }
  4. seems that you are looking for something like this (replace table and columns name for the real ones) SELECT tbl1.horse1, tbl1.horse1_odds, b.fav AS Horse1_fav, tbl1.horse2, tbl1.horse2_odds, c.fav AS Horse2_fav, tbl1.horse3, tbl1.horse3_odds, d.fav AS Horse3_fav FROM tbl1 LEFT JOIN table2 AS b ON tbl1.horse1_fav = b.id LEFT JOIN table2 AS c ON tbl1.horse2_fav = c.id LEFT JOIN table2 AS d ON tbl1.horse3_fav = d.id in a side note; you should normalize your tabla 1 to eliminate the repeating groups (like horse*_odds and horse*_fav) (1NF violation)... examples & some further simple explanation here: http://www.troubleshooters.com/littstip/ltnorm.html
  5. you are the only one that could know how your transaction id field is called... either way.. assuming (for you to check) that your field name is nSTId you can assign it value to some variable here: $this_user = $srow['nUserId']; $other_user = $srow['nUserReturnId']; $transactionId = $row['nSTId']; and use $transactionId in the rest of your code
  6. where in your SELECT are you getting the nTransactionId column (assuming that the column exists in your table users)? $sql = "SELECT vLoginName,vFirstName,vLastName,vAddress1,vAddress2,vCity,vState, vCountry,nZip,vPhone,vFax,vEmail FROM " . TABLEPREFIX . "users U where nUserId='" . $this_user . "' ";
  7. @tjburke79: HINT: explore the GROUP_CONCAT() function (be aware of the size limitations)
  8. @jacbey: error means that your query is failing, a good reason for that is the usage of a mysql reserved word read is one of them.... 2 options: a) change the name of the column (the best long term solution) or b) enclose it in backtics in this way `read`
  9. yes. did you read the UPDATE manual pages? http://dev.mysql.com/doc/refman/5.0/en/update.html the last few paragraphs before the "Users Comments" show you how.... hint: JOIN
  10. no... this is what you have (gif attached)... you will see that the relations are not correct based on your description. Edit: I saw that you added a store entity... good... now think about the item table.... should be the item name (apparently field `item`) be present in that table? [attachment deleted by admin]
  11. I did notice also that in `item` the attribute `item_id` is duplicated, and probably `store` should be a FK to another entity (stores)
  12. the answer depend on what each entity represent and how the relation among them is read (members is clear, item is suspicious, lists no clear) BTW.: The PK on `lists` is incorrect
  13. if the file was encrypted with a key or passcode you need to have it to decrypt.
  • 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.