Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mikosiko

  1. worth a read as a general guidance: http://en.wikipedia.org/wiki/Join_(SQL)
  2. and probably you will need a SUM and a GROUP by clause
  3. this a working/tested select based on your data. SELECT wp_bp_groups.name, GROUP_CONCAT( wp_bp_xprofile_data.value ORDER BY wp_bp_xprofile_data.field_id ) FROM (wp_bp_xprofile_data JOIN wb_bp_groups_members ON wp_bp_xprofile_data.user_id = wb_bp_groups_members.user_id) JOIN wp_bp_groups ON wp_bp_groups.id = wb_bp_groups_members.group_id GROUP BY wp_bp_groups.name;
  4. if you data type is INT(11) ideally you should be using numbers no '1'... and to fix an omission in my previous answer... in reality the final result is Rows 1 - 1, 1 - 2 and 2 - 1
  5. LEFT JOIN users u ON news u.user_id = n.user_id ORDER BY news check what is marked in red
  6. WHERE episodea.animeid = '1' OR episodeb.animeid = '1' and why then are you using strings here?
  7. @pikachu I know that you know
  8. in addition to what was already explained check what data type is animeid .... number?
  9. seems that you didn't understand my answer... lets try with an example: Table A id_a Table B id_b Rows Values in Table A 1 2 Rows Values in Table B 1 2 CARTESIAN PRODUCT between Table A and Table B (result from a SELECT like yours) 1 - 1 1 - 2 2 - 1 2 - 2 applying your conditions WHERE episodea.animeid = '1' OR episodeb.animeid = '1' Final result Rows 1 - 1 and 2 - 1 more clear?
  10. how both tables are related to each other?.... that select is doing a Cartesian product
  11. INSERT INTO book (title, cost, no in stock) is not the error obvious?
  12. if you rename your index.php file this 2 lines must be modified accordingly <form action="./" method="post"> and header('Location: ./')
  13. JOIN the Interest table 3 times (different aliases)
  14. this line in your code: $dob = $row = $row['dob']; is most likely causing the problem
  15. @chris90: After you solve your code syntax problems you should modify your code to execute just one query and no multiples in a loop (no efficient)... to do that, be aware that you can insert multiples rows in one INSERt clause in this way: INSERT INTO reservations (<your table fields names separated by , excluding any auto-increment>) VALUES (<your field values>), (<another set>), (<another set>); having that in mind you can just use the loop to create the VALUE portion of the string and out or the loop execute the query.... more efficient... one query/one access to the DB.. also... looking to what you are trying to insert looks that you DB has some design problems (fields with duplicated values)... but that is a different tale
  16. add this 2 lines at the beginning of your code (after <?php) to enable display of errors error_reporting(E_ALL); ini_set("display_errors", true); now... what are you trying to do here? ... while($row = mysql_fetch_array($result)<$numtd) { and post your complete code... the portion that you posted has unmatched {}
  17. the error that you are getting normally is caused for an unmatched ( or { or ; check that... in also fix the error that already I did mention. in addition... you have more errors in your code... like p.e, the while usage is fubar... so please review your code logic
  18. maybe you want to do (no a complete code... just to show you an example): 
 $all = "SELECT * FROM video ORDER BY id"; $result = mysql_query($all); while($row = mysql_fetch_array($result)) { etc. etc }
  19. if this is the complete result of echo sql; Last Query: UPDATE user SET username='', password='jimmy', firstname='', lastname='pakistan' WHERE id= then the error that you are getting is correct because your sentence is incomplete... there is nothing after id=
  20. first... don't comment the IF clause that is necessary to control in case you query doesn't return values. regarding the totals.... sure it is possible... just define total variables for each column ... accumulate the desire columns in those variables inside the while loop and print them at the end of the loop before to close the table
  21. again... what echo $sql; shows
  22. did you echo $sql; ?? what it shows?
  23. seems like a translation/better explanation is in-order here ... maybe you should rephrase/explain it
  24. no.... here is a quick example (shooting from my hip) ... untested... but you will get the idea: $sql = "SELECT type, SUM(mdInclTerror) as incl_Terror, SUM(legalExpenses) as legal_exp, SUM(el + pl + pol ) as liability FROM tblMaster WHERE insurer='F3' GROUP BY type"; $result = mysql_query($sql) or die("Query Error: " . mysql_error()); if ($result && mysql_num_rows($result) > 0) { // Start your table echo "<table align='center' cellpadding='10px'>"; echo "<tr>"; echo "<td align='center'>Type</td>"; echo "<td align='center'>100% MD Including</td>"; echo "<td align='center'>100% Liability</td>"; echo "<td align='center'>100% Legal Expenses</td>"; echo "</tr>"; while($row = mysql_fetch_assoc($result)){ $inclTerror= (float) $row["incl_Terror"]; $legal= (float) $row["legal_exp"]; $liability= (float) $row["liability"]; echo "<tr><td align='right'>".$row['type']."</td>"; echo "<td align='center'>£".$inclTerror."</td>"; echo "<td align='center'>£".$liability."</td>"; echo "<td align='center'>£".$legal."</td></tr>"; } echo "</table>";
×
×
  • 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.