Page 1 of 1

Customer reply email trouble

Posted: Mon May 18, 2009 6:26 pm
by asilveri
Script URL:http://ruxchng.rutgers.edu/tickets/
Version of script:2.0
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

Hello, I have been trying to edit the new ticket reply feature to include the category name that the customer selected. I added a SELECT statement to get the category name given its id. It failed as it returns an unexpected value.

I added the following SELECT statement under the submit_ticket.php file:

$qry = "SELECT `name` FROM `".$hesk_settings['db_pfix']."categories` WHERE `id`='".$category."'";

$catname = hesk_dbQuery($qry);

$message=str_replace('%%CATEGORY%%',$catname,$message);

When the customer receives the email they get the following message:

Dear eeee,

Your Resource id #8 support ticket "Testing categories" has been submitted.
We try to reply to all tickets as soon as possible, usually within 24 hours.

Instead of saying "Resource id # 8" it should be saying the selected category name ("Dining Services Computer Support")

This is the contents of the mysql table:

mysql> SELECT * FROM hesk_categories;
+----+----------------------------------+-----------+
| id | name | cat_order |
+----+----------------------------------+-----------+
| 1 | Dining Services Computer Support | 10 |
| 10 | RU Express / Meal Plan | 20 |
| 6 | Other | 50 |
| 11 | Dining Services Facilities | 30 |
| 12 | Sanitarian | 40 |
+----+----------------------------------+-----------+

I also displayed the SELECT statement:

Your SELECT `name` FROM `hesk_categories` WHERE `id`='1' support ticket "Testing categories" has been submitted.

[/quote]

Posted: Mon May 18, 2009 7:22 pm
by Klemen
After the hesk_dbQuery you need to fetch results for example using hesk_dbFetchAssoc (or with original functions - after mysql_query() you need to use mysql_fetch_assoc() to get the result).

Change

Code: Select all

$catname = hesk_dbQuery($qry); 
to

Code: Select all

$myres = hesk_dbQuery($qry);
$mytmp = hesk_dbFetchAssoc($myres);
$catname = $mytmp['name'];
http://www.google.com/search?hl=en&q=php+mysql+tutorial

Thanks

Posted: Mon May 18, 2009 7:45 pm
by asilveri
Thanks again Klemen for your prompt and effective response.

:D