Hey there, I'm still relitivley new to php & MySQL and I really could do with a little help.
I'm using a script on my site that amongst other things is a CRM script, it has a very basic support feature where a user fills in a form and the details are sent to an email address for me to view.
I wanted to 'upgrade' this feature into a basic ticket system. I've created tabels for the initial request and another table for any updates made to it by the user or staff.
Now the forms that make the initial request and updates work fine, they're submitting all the data correctly and I have a page set up to view the initial request but my problem is getting said page to display any and all updates as well as the original request.
This is the code that displays the original request
PHP Code:
elseif ($q == "ticket_view") {
include("header.html");
$url_id = $_GET['t'];
$tickets = mysql_db_query($db, "SELECT * from table_tickets where id='$url_id' ", $connection);
check_mysql($tickets);
while ($row = mysql_fetch_array($tickets)) {
$ticket_id = $row["id"];
$ticket_date = $row["date"];
$ticket_subject = $row["subject"];
$ticket_domain = $row["domain"];
$ticket_priority = $row["priority"];
$ticket_contents = $row["contents"];
$ticket_poster = $row["name"];
$filename = "ticket_view.html";
$handle = fopen ($filename, "r");
$contents = fread ($handle, filesize ($filename));
$contents = str_replace(XticketX, $ticket_id, $contents);
$contents = str_replace(XdateX, $ticket_date, $contents);
$contents = str_replace(XsubjectX, $ticket_subject, $contents);
$contents = str_replace(XdomainX, $ticket_domain, $contents);
$contents = str_replace(XpriorityX, $ticket_priority, $contents);
$contents = str_replace(XmessageX, $ticket_contents, $contents);
$contents = str_replace(XposterX, $ticket_poster, $contents);
$contents = str_replace(Xupdate_posterX, $update_poster, $contents);
$contents = str_replace(Xupdate_dateX, $update_date, $contents);
$contents = str_replace(Xupdate_messageX, $update_contents, $contents);
print $contents;
fclose ($handle);
}
include("footer.html");
}
Like I said that works in as much as it displays the original request but what code would I have to add to that to get it display details from another database table?
The other table I wish to display results from is called
table_ticket_replies and the fields are
content, date, ticketid.
If anyone could offer help I'd really appreciate it.
--Matt