Here is the page:

<?php

include( "mypath.php" );
include( "{$filepath}/config/clientdbconnect.php" );
if ( ------------------------- )
{
    #exit( "Security Violation" );
}
include( "header.php" );

$sqle = "select * from helpconfig where cid = '1'";
if ( !( $resulte = mysql_query( $sqle ) ) )
{
    exit( mysql_error( ) );
}
while ( $rowe = mysql_fetch_array( $resulte ) )
{
    $ticketlimit = $rowe['ticketlimit'];
    $ticketdlimit = $rowe['ticketdlimit'];
    $flash = $rowe['flash'];
}
$interface = grab_template( "support_center_head.html", $cusid );
$sqle = "select * from helpconfig where cid = '1'";
if ( !( $resulte = mysql_query( $sqle ) ) )
{
    exit( mysql_error( ) );
}
while ( $rowe = mysql_fetch_array( $resulte ) )
{
    $chaturl = $rowe['chaturl'];
}
if ( $chaturl )
{
    $chaturl = str_replace( "{username}", $username, $chaturl );
    $chaturl = str_replace( "{password}", $password, $chaturl );
    $interface = str_replace( "javascript: openwindow('chat.php');", "{$chaturl}", $interface );
}
if ( $flash != "Y" )
{
    $interface = str_replace( "<img src=\"".$url."/templates/skin/button_flashtut.gif\" width=\"144\" height=\"35\" border=\"0\">", "", $interface );
}
echo $interface;

$sqle = "select * from helpconfig where cid = '1'";
if ( !( $resulte = mysql_query( $sqle ) ) )
{
    exit( mysql_error( ) );
}
while ( $rowe = mysql_fetch_array( $resulte ) )
{
    $supporturl = $rowe['supporturl'];
    $chaturl = $rowe['chaturl'];

    echo "<table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing= \"0\">\n        <tr>\n          <td> </td>\n          <td valign=\"top\"><div align= \"left\">\n              <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding= \"0\">\n                <tr>\n                  <td width=\"5%\"><img src=\"../images/view- statistics.gif\" width=\"26\" height=\"20\"> </td>\n                  <td width=\"95% \">  <strong>My Help Requests</strong></td>\n                </tr>\n               </table>\n          </div></td>\n          <td> </td>\n        </tr>\n        <tr>\n           <td width=\"13\" background=\"../images/leftbar.gif\"> </td>\n          <td  valign=\"bottom\" background=\"../images/top-bar.gif\"><div align=\"right\"></div></td>\n           <td width=\"16\" background=\"../images/rightbar.gif\"> </td>\n        </tr>\n         <tr>\n          <td> </td>\n          <td><table width=\"100%\" border=\"0\"  align=\"center\" cellpadding=\"2\" cellspacing=\"2\" bordercolor=\"#FFFFFF\">\n                 <tr bordercolor=\"#eeeeee\" bgcolor=\"#f5f5f5\">\n              <td> <div align=\"left \"><font color=\"#000000\">Call\n                  ID</font></div></td>\n              <td>  <div align=\"left\"><font color=\"#000000\">Status</font></div></td>\n              <td>  <div align=\"left\"><font color=\"#000000\">Subject</font></div></td>\n              <td>  <div align=\"left\"><font color=\"#000000\">Date\n                   Opened</font></div></td>\n            </tr>\n            ";
    $sqlc = "SELECT * from `calls` WHERE 1 AND status!='CLOSED' and cid='".$cid."' LIMIT 0,  30";
    if ( !( $resultc = mysql_query( "{$sqlc}" ) ) )
    {
        exit( mysql_error( ) );
    }
    while ( $rowc = mysql_fetch_array( $resultc ) )
    {
        $rowc['subject'] = str_replace( "&", "&", $rowc['subject'] );
        $pid = $rowc['pid'];
        echo "  <tr bgcolor='#f5f5f5'  onMouseOver=this.style.cursor='pointer',this.style.backgroundColor='#F4FAFD'  onMouseOut=this.style.backgroundColor='#F5F5F5'  onclick=this.style.backgroundColor='#84B5CB',location.href='view_ticket.php?pid=".$pid."'  bordercolor=#FFFFFF>";
        echo "    <td><div align='left'> <a href=view_ticket.php?pid=".$pid.">";
        echo $rowc['pid'];
        echo "</a></td><td><div align='left'><a href=view_ticket.php?pid=".$pid."> ";
        echo $rowc['status'];
        echo "</a></td><td><div align='left'> <a href=view_ticket.php?pid=".$pid.">";
        echo $rowc['subject'];
        echo "</a></td><td><div align='left'> ";
        echo $rowc['date'];
        echo "</td></tr>";
    }
    $totalrows = mysql_num_rows( $resultc );
    if ( $totalrows == 0 )
    {
        echo "<tr bordercolor=#FFFFFF><td height=22><font face='Arial, Helvetica, sans- serif'>  No Calls Opened</td><td> </td><td> </td><td> </td></tr>";
    }
    echo "          </table></td>\n          <td> </td>\n        </tr>\n        <tr>\n           <td background=\"../images/bottomleft.gif\"> </td>\n          <td background= \"../images/bottom.gif\"> </td>\n          <td background=\"../images/bottomright.gif \"> </td>\n        </tr>\n      </table>                   \n        ";
}

echo "<br>\n<table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\n  <tr>\n    <td> </td>\n    <td valign=\"top\"><div align=\"center\">\n        <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n          <tr> <a name=\"statistics\" id=\"statistics\"></a>\n              <td width=\"36\"><div align=\"center\"><img src=\"../images/helpdesk.gif\" width=\"20\" height=\"16\"></div></td>\n              <td width=\"96%\"><strong>  Closed Tickets </strong></td>\n              <td width=\"36\"> </td>\n          </tr>\n        </table>\n    </div></td>\n    <td> </td>\n  </tr>\n  <tr>\n    <td width=\"13\" background=\"../images/leftbar.gif\"> </td>\n    <td valign=\"bottom\" background=\"../images/top-bar.gif\"><div align=\"right\"></div></td>\n    <td width=\"16\" background=\"../images/rightbar.gif\"> </td>\n  </tr>\n  <tr>\n    <td> </td>\n    <td><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\" bordercolor=\"#FFFFFF\">\n        <tr bordercolor=\"#eeeeee\" bgcolor=\"#eeeeee\">\n          <td bordercolor=\"#eeeeee\"><div align=\"left\"><strong>Call ID</strong></div></td>\n          <td><div align=\"left\"><strong>Status</strong></div></td>\n          <td><div align=\"left\"><strong>Subject</strong></div></td>\n          <td><div align=\"left\"><strong>Date Opened</strong></div></td>\n        </tr>\n        ";
$a = 1;
$sqlc = "SELECT * from `calls` WHERE 1 AND status='CLOSED' and cid='".$cid."' ORDER by `pid` DESC";
if ( !( $resultc = mysql_query( "{$sqlc}" ) ) )
{
    exit( mysql_error( ) );
}
while ( $rowc = mysql_fetch_array( $resultc ) )
{
    $rowc['subject'] = str_replace( "&", "&", $rowc['subject'] );
    if ( $a == "3" )
    {
        $a = 1;
    }
    if ( $a == "1" )
    {
        $bgcolor = "#EEEEEE";
    }
    else
    {
        $bgcolor = "#F5F5F5";
    }
    $pid = $rowc['pid'];
    echo "  <tr onMouseOver=this.style.cursor='pointer',this.style.backgroundColor='#CCCCCC' onMouseOut=this.style.backgroundColor='#eeeeee' onclick=this.style.backgroundColor='#84B5CB',location.href='view_ticket.php?pid=".$pid."' bordercolor=#FFFFFF bgcolor={$bgcolor}>";
    echo "    <td><div align='left'> ";
    echo $rowc['pid'];
    echo "</td><td><div align='left'> ";
    echo $rowc['status'];
    echo "</td><td><div align='left'> <a href=view_ticket.php?pid=";
    echo $rowc['pid'];
    echo ">";
    echo $rowc['subject'];
    echo "</a></td><td><div align='left'> ";
    echo $rowc['date'];
    echo "</td></tr>";
    $a += 1;
}
echo "</table>";
$totalrows = mysql_num_rows( $resultc );
if ( $totalrows == 0 )
{
    echo "<table width=100%>  No Closed Tickets</table>";
}
echo "    </table></td>\n    <td> </td>\n  </tr>\n  <tr>\n    <td background=\"../images/bottomleft.gif\"> </td>\n    <td background=\"../images/bottom.gif\"> </td>\n    <td background=\"../images/bottomright.gif\"> </td>\n  </tr>\n</table>\n<p align=\"center\">";
include( "footer.php" );
echo "</p>\n";
?>

--

Here is the double form:

http://webhost.pro/blog/wp-content/uploads//2014/07/double.gif

(not sure how to post a image in this thread)

Recommended Answers

All 4 Replies

Your table is being echoed in a while loop though, so it's not impossible to have it show up more than once, if there is more than one item in the array.

$sqle = "select * from helpconfig where cid = '1'";
if ( !( $resulte = mysql_query( $sqle ) ) )
{
exit( mysql_error( ) );
}
while ( $rowe = mysql_fetch_array( $resulte ) )
{
    //table building

Does that part really return one result?

FYI, about the mysql_fetch_array you're using:

Warning

This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:

    mysqli_fetch_array()
    PDOStatement::fetch()

escaping those html tags must hurt your pinky finger :). Years back, there was a great argument on " single quotes vs. double quotes".

so, this one is pretty valid

$form = '<form action="" method="post">';

although this is valid, it keeps your pinky finger busy.

$form = "<form action =\"\" method=\"post\">";

while this one is just the complete opposite of the two. I don't recommend it.

$form = "<form action='' method='post'>";

This fixed it:

Run this statement against your database directly..

php: [Select]
1
select * from helpconfig where cid = '1'

It will return 2 rows..

If you change it to ..

php: [Select]
1
select * from helpconfig where cid = '1' LIMIT 1

then you will get 1 row back

select * from helpconfig where cid = '1'
It will return 2 rows..

If you get 2 or more rows returned from what you said, something is not right. Either your table has 2 duplicated rows or something in your setting is off... You should never need to LIMIT the number of rows if you know that the condition given is a unique value in the table.

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.