How to group cells together in columns, in PHP


errornosignal
7/5/2016 5:43 am
HOME » Web Development

I have written code in PHP (listed below,) but face a small problem...

<html>
<head>
<title> trans </title>
<body>
<style>
table, th, td {
border: 1px solid black;
width: 700px;
margin: auto;
}
</style>
<?php

$con = mysqli_connect('localhost', 'root', '');
if(!$con)
{
    die("not ok");
}

mysqli_select_db($con,"uoh");  


$q1 = "SELECT * FROM student_record INNER JOIN degree_plan ON
 student_record.course_number = degree_plan.course_number 
 INNER JOIN courses ON student_record.course_number = 
 courses.course_number where student_record.id  = 201102887 AND
degree_plan.major='COE'";

$result = mysqli_query($con , $q1 ) ;
if($result){
   echo "<table>";
   echo "<tr>";
   echo "<th>courses</th>";
   echo "<th>terms</th>";
   echo "<th>grades</th>";
   echo "<th>CRD</th>";
   echo "</tr>";
while($row = mysqli_fetch_array($result))
{

   echo "<tr>";
   echo "<td>" . $row["code"]. "</td>";
   echo "<td>" . $row["term_no"]. "</td>";
   echo "<td>" . $row["grade"]. "</td>";
   echo "</tr>";
}
echo "</table>";
   }

?>

</body>
</html>

When I run the code I see the following output:

---------------------------------------
|   courses    |   terms  |   grades  |
---------------------------------------
|   CHEM 101   |     1    |     A     |
---------------------------------------
|   ENGL 101   |     1    |     C+    |
---------------------------------------
|   PE 101     |     1    |     B     |
---------------------------------------
|   PHYS 101   |     1    |     F     |
---------------------------------------
|   ENGL 102   |     2    |     B+    |
---------------------------------------
|   PE 101     |     2    |     B     |
---------------------------------------
|   PHYS 102   |     2    |     D+    |
---------------------------------------
|   MATH 201   |     3    |     A     |
---------------------------------------
|   COE 200    |     3    |     B     |
---------------------------------------

But I do not want it like that. I want the term cells to become one, like this:

---------------------------------------
|   courses    |   term   |   grade   |
---------------------------------------
|   CHEM 101         1          A     |
|   ENGL 101                    C+    |
|   PE 101                      B     |
|   PHYS 101                    F     |
---------------------------------------
|   ENGL 102         2          B+    |
|   PE 101                      B     |
|   PHYS 102                    D+    |
---------------------------------------
|   MATH 201         3          A     |
|   COE 200                     B     |
---------------------------------------

or in any other way that does not let term repeat, by which I mean: group the courses that have the same term together.


Related to : How to group cells together in columns, in PHP
How to group cells together in columns, in PHP
7/5/2016 5:43 am by errornosignal in Web Development

I have written code in PHP (listed below,) but face a small problem...

<html>
<head>
<title> trans </title>
<body>
<style>
table, th, td {
border: 1px solid black;
width: 700px;
margin: auto;
}
</style>
<?php

$con = mysqli_connect('lo
VBA Conditional concatenate of a group of cells in two columns
by Steve Downing in Web Development

This is far to advanced for me to figure out.
Here is an example of the worksheet layout:


Row# ColA ColB
23 7   Description
24 8   Description
25
26  For cases with
27
Mixing of GROUP columns (MIN(),MAX(),COUNT(),…) with no GROUP columns is illegal if there is no GROUP BY clause
by jcwagers in Web Development

I'm using an old php script and have an error with this query. Since I'm not experienced with mysql, I couldn't fix it.


"SELECT COUNT(p.postid) AS pid, p.*, t.* FROM ".TABLE_PREFIX."post AS p
INNER JOIN ".TABLE_PREFIX."thread AS t ON (p.threadid = t.threadid) WHERE
p.us
error: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is ill
by Pure Pandemonium in Web Development
I am getting this error on the page:
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
My previous code was:
PHP Code:
For each row, copy specific cells by predefined columns and paste to values into alternate predefined columns in a seperate worksheet
by Sweden in Web Development

I have to select data from one Excel worksheet and copy into into a different worksheet, however I need to achieve the following during the process of copying my data over:


For each row of the original worksheet, select cells by column (which I can predefine, perhaps using an array or


Nhibernate many columns in group by clause, number of columns may differ by time
by VulgarDisplay in Web Development

i have a following problem,
I have windows form with 6 checkboxes, each means different column to group by results.
After executing query I should pass data to gridView's DataSource.


However, I've never done such a thing and can't find a way for me to achive that, I googled


Use LINQ to group by multiple columns and read values of ungrouped columns
by Bakafish in Web Development

I need to group a data table on multiple columns and also read data of un-grouped columns


col1 col2 col3 col4 col5 col6 col7 col8 .. col16


Here i am grouping it on col1, col2 ... col6. But facing problems in reading values of col7 ... col16


var groupedRows =
Select count of rows with group by multiple columns with minimum of 1 of the columns
19/1/2015 4:20 pm by algoRhythm99 in Web Development
Table Structure:
CASENUM NUMBER(15,0)    No
DESCRIPTION VARCHAR2(150 BYTE)  Yes
COMPLETED   VARCHAR2(5 BYTE)    Yes
USERID  VARCHAR2(10 BYTE)   Yes
TRIGGERDATE DATE    Yes
DOCUMENTID  VARCHAR2(10 BYTE)   Yes
ROWSEQ  NUMBER  Yes
UPDATEDON   DATE    Yes
TRIGTYPE    VARCHAR2(5 BYTE)    Yes
<
Select DataTable (only some values) from ???_GetDisplayData and GROUP data by days where group rules is different for different columns
by KompuKare in Web Development

Overflow :3 I've got a kind of hard-case question.


So I'll try clearly explain my idea
with my poor english :/ need
select to DataTable SOME values
from ???_**GetDisplayData
**procedure for each day of previos month (GROUP IT) where group rules for


Mixing of Group Columns with No Group Columns :
by LeeFlannery in Web Development

I got this error and I'm not sure how to work with it. Simple explanations would be much appreciated. Error:


1140: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause - SELECT email, COUNT(*) AS record


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .