Hello,

I Have created an admin page to view user account information on monthly bassis but the values to me are not showing up here is the code

                    <?php
                        $record_campaign = mysql_query("SELECT campaign FROM dailyreport where uid='" . intval($_POST['select3']) . "'");
                        $record6      = mysql_fetch_array($record_campaign);
                        $campaign     = $record6['campaign'];
                        $date_table   = "Date";
                        $tleads_table = "Total Leads";
                        $cleads_table = "Completed Leads";
                        $opacc_table  = "Open Accounts";
                        $nsure_table  = "Not Sure";
                        $lupload      = "Logo Uploaded";

                        echo "<table border='1' cellpadding='2' cellspacing='2' style='width:150%;'>";
                        echo "<tr>";
                        echo "<th>Date</th>";
                        echo "<th>Total Leads</th>";
                        echo "<th>Completed Leads</th>";

                        if ($campaign=="Bank Verification" ) {
                            echo "<th>Open Account</th>";
                            echo "<th>Not Sure</th>";
                        }
                        else if ($campaign=="Creative Merch") {
                            echo "<th>Logo Uploaded</th>";                                
                        }
                        echo "<th> Campaign</th>";
                        echo "<th>File Submitted</th>";
                        echo "<th>Reason</th>";
                        echo "<th>Comments</th>";
                        echo "</tr>";

                    ?>
                    <?php
                        $month = $_POST["select1"];
                        if($_GET["show"]==1) {
                            $month = $_POST["select1"];
                            $year = $_POST["select2"];
                        }else {
                            $month = date("m");
                            $year = date("Y");
                        }
                        if($_GET["can"]==1) { $user = $_GET["user"]; }
                             $startday = 1;
                                             if($month==1||$month==3||$month==5||$month==7||$month==8||$month==10||$month==12) {
                            $endday = 31; 
                        }
                        if($month==4||$month==6||$month==9||$month==11) {
                            $endday = 30;
                        }
                        if($month==2){
                            if($year%4==0){
                                $endday = 29;
                        }else {
                            $endday = 28;
                        }
                        }
                         echo "<script language = 'javascript'>
                        form1.select1.options[",$month-1,"].selected = true;
                        form1.select2.options[",$year-2012,"].selected = true;
                        </script>";

                        $date1 = $year."-".$month."-".$startday;
                        $date2 = $year."-".$month."-".$endday;

                            $recordset5 = mysql_query("select * from dailyreport where date between '".$date1."' and '".$date2."' and (uid=0 or (uid=" .intval($_POST['select3']).")) order by date");
                            $days = 0;
                            while($row3 = mysql_fetch_array($recordset5)) {
                                $days = $days + 1;
                                echo "<tr><td>" . $date = $row3['date'] . "</td>";
                                echo "<td>" . $totalleads = $row3['tleads'] . "</td>";
                                echo "<td>" . $totalcomp  = $row3['cleads'] . "</td>";

                                if ($campaign=="Bank Verification" ) {
                                    echo "<td>" . $open_acc = $row3['op_acc'] . "</td>";
                                    echo "<td>" . $notsure  = $row3['nsure'] . "</td>";
                                }
                                else if ($campaign=="Creative Merch") {
                                    echo "<td>" . $logo_upload = $row3['lupload'] . "</td>";
                                }
                                echo "<td>" . $campaign = $row3['campaign'] . "</td>";
                                echo "<td>" . $file_del = $row3['fdelivered'] . "</td>";
                                echo "<td>" . $$reason  = $row3['reason'] . "</td>";
                                echo "<td>" . $comments = $row3['comments'] . "</td>";
                                echo "<tr/>";
                            }

                            $record_open    = mysql_query("SELECT SUM(op_acc) FROM dailyreport where uid={$user}");
                            $total_open     = mysql_fetch_array($record_open);

                            $record_nsure   = mysql_query("SELECT SUM(nsure) FROM dailyreport where uid={$user}");
                            $total_nsure    = mysql_fetch_array($record_nsure);

                            $record_tleads  = mysql_query("SELECT SUM(tleads) FROM dailyreport where uid={$user}");
                            $total_tleads   = mysql_fetch_array($record_tleads);

                            $record_cleads  = mysql_query("SELECT SUM(cleads) FROM dailyreport where uid={$user}");
                            $total_cleads   = mysql_fetch_array($record_cleads);

                            $record_logo    = mysql_query("SELECT SUM(lupload) FROM dailyreport where uid={$user}");
                            $total_logo     = mysql_fetch_array($record_logo);

            echo"</table>";
            echo "</div>";
        if ($campaign=="Bank Verification" ) {
        echo"<label style='margin-top:30px;'><p style='width:55%;'>Total Open Accounts in this Month</p><p>",$total_open[0],"</p><label>";
        echo"<label><p style='width:55%;'>Total Not Sure in this Month</p><p>",$total_nsure[0],"</p><label>";
    }
    else if ($campaign=="Creative Merch") {
        echo"</table>";
        echo"<label style='margin-top:30px;'><p style='width:55%;'>Total Logo Uploaded in this Month</p><p>",$total_logo[0],"</p><label>";
    }

    echo"<label><p style='width:55%;'>Total Leads in this Month</p><p>",$total_tleads[0],"</p><label>";
    echo"<label><p style='width:55%;'>Total Completed Leads in this Month</p><p>",$total_cleads[0],"</p><label>";
        $recordset3 = mysql_query("select * from users where uid=".$user);
                while($record3 = mysql_fetch_array($recordset3)){
                echo"<script>
                for(k=0; k< form1.select3.length; k++) {
                if(form1.select3.options[k].text =='".$record3["ulogin"]."') {
            form1.select3.options[k].selected = true;
            }
        }
    </script>";
    }                 
?>

The condition which I have placed is not working if ($campaign=="Bank Verification" ) and $total_cleads[0], are also showing the values it is running okay on user page but not working properly on admin page

Thank You

Member Avatar for diafol

You're not getting any replies. I would imagine a number of reasons:

1) Indenting extreme - suggest repost with sensible indenting
2) Using mysql functions - I've stopped helping wrt these. Maybe others have too.
3) Mixed up PHP and HTML - even php derived js! Suggest you separate these out as much as possible. You can pass data to HTML rather than have PHP spit the whole lot out - you certainly do not want loads of echoes. If you must do this concatenate strings and just echo once.
4) Inline styling instead of CSS - just provides more clutter and confusion

If you need clarification on any of the above, let me know. Here to help.

Hello Sir Thank You Very Much it was minor problem which was not correctly wrtiiten its working perfectly now :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.