954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

PHP and Gouping of Records

Hi..
I am new to PHP Mysql and i am facing following problem..
..............................
Database

1 G
1 G
1 G


...........................

I want to print records like this

...........................


1---[INDENT]g[/INDENT][INDENT]g[/INDENT][INDENT]g[/INDENT]
..............................
As we do in in crystal reports ( suppress if duplicated )

ALSO
PLEASE SUGGEST ME WHICH REPORTING TOOL IS USED IN PLACE OF
CRYSTAL REPORT FOR PHP MYSQL BASED WEB APPLICATION..
.
SO THAT WHEN THE WEBSITE IS HOSTED ON WEB SERVER
THEN THAT REPORTING TOOL IS PRESENT ON WEBSERVER
.

CRYSTAL REPORTS HAS LOTS OF FUNCTIONALITY BUT I DON'T
KNOW WHEATHER IT IS USED IN PHP/MYSQL APPLICATION OR NOT

....

PLEASE REPLY FAST

Please Help me out of it....

............................Thanks in advance

garyrichard
Newbie Poster
20 posts since Oct 2011
Reputation Points: 10
Solved Threads: 1
 

Try the following:

<?php 
$r=mysql_query('SELECT * FROM `table` ORDER BY `num` ASC') or die(mysql_error());
$prev='';
while ($row=mysql_fetch_assoc($r)) {
if ($row['num']!=$prev) {
    echo $row['num'].' ';
    }
echo 'G';
$prev=$row['num'];
}
?>

Don't forget the replace 'num' with the column name.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

Thanks a lot..
...

Can u suggest me the reporting tool for PHP MySql...

which is used in advance programming level of PHP/MySql....

garyrichard
Newbie Poster
20 posts since Oct 2011
Reputation Points: 10
Solved Threads: 1
 

Do you mean phpmyadmin?

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

As we use crystal reports in Visual Studio 2008
Simillar to that one..
Bcz crystal report has lots of good functionallity
like SUPPRESS IF DUPLICATED, VARIOUS FORMULA AND PARAMETERS ETC...

..............
As i want to fetch record from MYsql using PHP
by passing parameter and the related records are shown in a report.
which can be exported into PDF format..etc...

garyrichard
Newbie Poster
20 posts since Oct 2011
Reputation Points: 10
Solved Threads: 1
 

So did you want php to place the contents into a pdf or did you want crystal reports in Visual Studio to create the pdf? PHP has a pdf library which can be found at http://au2.php.net/manual/en/book.pdf.php For examples on the pdf module embedded into google I would suggest a simple google search.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

I have just given the example of Visual Studio 2008
............
I want that user will be asked to find records having SRNO between 1 and 2
then record is printed in format like below..
.............
1-A
B
C
D
2-A
B
C
D

............

Here 1 and 2 are passed as parameters...
................

May be my Post is little bit confusing..
i apologize for that...
I just want to know..that is there any reporting tool used
in PHP mysql...
which is helpfull like Crystal reports 11..
For easily generating reports...

garyrichard
Newbie Poster
20 posts since Oct 2011
Reputation Points: 10
Solved Threads: 1
 
<?php 
$r=mysql_query('SELECT * FROM `table` ORDER BY `num` ASC') or die(mysql_error());
$prev='';
while ($row=mysql_fetch_assoc($r)) {
if ($row['num']!=$prev) {
    $i=0;
    echo $row['num'].'-A';
    } else {
    $i++;
    echo strtoupper(dechex($i+10)).'';
    }
$prev=$row['num'];
}
?>
cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

Can i Encrypt my PHP code before deploying it
to server
so
if in future my client hires an another web developer
then
he will not be able to use my source code...

garyrichard
Newbie Poster
20 posts since Oct 2011
Reputation Points: 10
Solved Threads: 1
 

When it comes to encoding php code there are two options. You can use a free php script such as pobs and it will jumble up the code in a way that will make it impossible to read then anybody trying to edit it will be facing a nightmare. There are commercial alternatives such as ioncube where it is harder to crack because you have to buy it to gain access to the encoder. However in my opinion the free pobs is just as good.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: