Web Hosting Talk







View Full Version : Support Status Script


Swelly
04-02-2006, 11:51 PM
Hello,

We at HostFrog are looking for a helpdesk status script that will show current open tickets (number wise) for each department. Does anyone know of a script such as this, or better yet where to get it at?

taylorwilsdon
04-03-2006, 12:06 AM
while($array=mysql_fetch_array("SELECT * FROM tickets WHERE status = 'open'")) {
$name = $array['name'];
ect
}


Shouldn't be hard to do, if you could post your table structure I could write you a working script.

taylorwilsdon
04-03-2006, 12:07 AM
quick followup - obviously you'd need to echo the information as well within the while loop (just so nobody says "omg bad code")

Swelly
04-03-2006, 12:09 AM
Ok thanks for you help garber :)

Mark S
04-03-2006, 12:38 AM
Was that all you needed, HostFrog?

Swelly
04-03-2006, 12:39 AM
Not really, I need someone to explain that really :P

Mark S
04-03-2006, 12:43 AM
HostFrog: I replied to your pm.

Your smiley is as green as a frog, Oh my!

Swelly
04-03-2006, 10:34 AM
I replied to you back. Let me know why what you come up with. Thank you! If anyone else has a script or something that can help us please respond or email product@host-frog.com

Swelly
04-03-2006, 01:53 PM
+-----------+-----------------------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-----------------------+------+-----+-------------------+-------+
| subject | varchar(50) | | | [No Subject] | |
| name | varchar(255) | | | | |
| email | varchar(255) | | | | |
| phone | varchar(20) | YES | | NULL | |
| status | enum('open','closed') | | | open | |
| ID | int(6) | | PRI | 0 | |
| cat | int(5) | | | 0 | |
| priority | tinyint(1) | | | 2 | |
| ip | varchar(255) | | | | |
| trans_msg | varchar(255) | | | | |
| timestamp | timestamp | YES | | CURRENT_TIMESTAMP | |
+-----------+-----------------------+------+-----+-------------------+-------+
11 rows in set (0.00 sec)


here is the table structure.

taylorwilsdon
04-04-2006, 02:17 AM
K, I think I can help you out.

$query = mysql_query("SELECT * FROM tickets WHERE status = 'open' ORDER BY priority");
while($array=mysql_fetch_array($query)) {
$name = $array['name'];
$id = $array['id'];
$subject = $array['subject'];
echo "<a href='viewticket.php?id=$id'>$name</a>";
}

Hopefully that helps, at least to some level. I wasn't sure of the table name and I didn't know how you wanted it displayed, but that might get you on the right track.
I'm writing this off the top of my head so feel free to correct anything.

Burhan
04-04-2006, 03:06 AM
Wow, do any of you read the rules? This is just rediculous. Follow the forum rules. You agreed to them when you signed up.

goofy -- nice effort, allow me to make the following observations:

1. You are pulling every field from the table, yet only using 2 of them.
2. You never display the subject :D


$query = "SELECT `name`, `id`, `subject` FROM `tickets` WHERE `status` = 'open' ORDER BY `priority`";
$result = mysql_query($query);
if (!$result) { die(mysql_error()); }
while($row = mysql_fetch_assoc($result))
{
echo $row['subject'].' created by '.$row['name'].'<a href="viewticket.php?id='.$row['id'].'">view</a><br />';
}

Swelly
04-04-2006, 03:38 PM
Thanks guys for your help. However when that script was executed, it showed subject, and had it able to view. We just want a NUMBER of total open tickets shown in each cat. We don't even need the name of the category as this will be placed into a table on the helpdesk. So just a number to show open tickets.

mripguru
04-04-2006, 03:43 PM
Thanks guys for your help. However when that script was executed, it showed subject, and had it able to view. We just want a NUMBER of total open tickets shown in each cat. We don't even need the name of the category as this will be placed into a table on the helpdesk. So just a number to show open tickets.

Kinda like what Site5 has? :eek:.

-Edward-
04-04-2006, 07:18 PM
Just change your sql statement to include a count and then use echo to pull that count variable.

WireNine
04-08-2006, 09:07 PM
I am no expert in php, but just doing a little research on php got me the following code which I think does exactly what you want HostFrog :)

$dbh=mysql_connect ("localhost", "DATABASE_USERNAME", "DATABASE_PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("DATABASE_NAME");

$result = mysql_query("SELECT COUNT(*) FROM `tickets` WHERE `status` = 'open'", $dbh);
$num_rows = mysql_num_rows($result);

echo "$num_rows Open Tickets\n";

I tested it and it works :)