mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
worth a read as a general guidance: http://en.wikipedia.org/wiki/Join_(SQL)
-
and probably you will need a SUM and a GROUP by clause
-
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;
-
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
-
LEFT JOIN users u ON news u.user_id = n.user_id ORDER BY news check what is marked in red
-
$gender returns '1' but not M or F as in the record
mikosiko replied to nomadsoul's topic in MySQL Help
nothing ... AFAIK -
WHERE episodea.animeid = '1' OR episodeb.animeid = '1' and why then are you using strings here?
-
@pikachu I know that you know
-
in addition to what was already explained check what data type is animeid .... number?
-
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?
-
how both tables are related to each other?.... that select is doing a Cartesian product
-
INSERT INTO book (title, cost, no in stock) is not the error obvious?
-
Whats wrong with my form when I rename my files?
mikosiko replied to stefsoko's topic in PHP Coding Help
if you rename your index.php file this 2 lines must be modified accordingly <form action="./" method="post"> and header('Location: ./') -
JOIN the Interest table 3 times (different aliases)
-
$gender returns '1' but not M or F as in the record
mikosiko replied to nomadsoul's topic in MySQL Help
this line in your code: $dob = $row = $row['dob']; is most likely causing the problem -
@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
-
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 {}
-
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
-
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 }
-
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=
-
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
-
again... what echo $sql; shows
-
did you echo $sql; ?? what it shows?
-
seems like a translation/better explanation is in-order here ... maybe you should rephrase/explain it
-
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>";