Jump to content

[HELP] Tickettool PHP


Blarg1988

Recommended Posts

Hey Guys,

 

i'm trying to create a small ticketing tool written in PHP with a MySQL DB.

What works:

I can successfully connect to my DB and i can create query where the Ticket-Data (written by the support-needed) is inserted into the DB.

 

What doesn't work:

i'm trying to get access to those data and display it in the ticket-overview, where the supportteam is able to do sth with all tickets.

 

If my problem is not understandable, i'll attach my php-files and my sql-file. (only 4 files, because i'm only allowed to attach four :( )

 

Hope anybody is able to help me, and give me a brief overview on how to do it.

 

And YES i've already used our well-known friend (google) ;-)

 

Greetings,

Blarg

 

EDIT:// I'm not good at php programming ( so please don't laugh ;-), cheers)

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/232764-help-tickettool-php/
Share on other sites

No one feels like downloading all those files.  Post the code that relates to:

alright then:

There you go:

 

<?php 
session_start();
require_once 'connect.php';
//require 'ticket_new_exec.php';
?>

<?php


/*$fname = clean($_POST['fname']);
$lname = clean($_POST['lname']);
$email = clean($_POST['email']);
$tel = clean($_POST['telefon']);
$prio = clean($_POST['priority']);
$betreff = clean($_POST['betreff']);
$beschreibung = clean($_POST['beschreibung']);*/

//Create query
$qry="SELECT * FROM newticket";
$result=mysql_query($qry);

//Check whether the query was successful or not
if($result) {
	if(mysql_num_rows($result) == 1) {
		//Ticket 
		session_regenerate_id();
		$ticket = mysql_fetch_assoc($result);
		$_SESSION['SESS_TICKET_ID'] = $ticket['ticket_id'];
		$_SESSION['SESS_FIRST_NAME'] = $ticket['fname'];
		$_SESSION['SESS_LAST_NAME'] = $ticket['lname'];
		$_SESSION['SESS_TEL'] = $ticket['tel'];
		$_SESSION['SESS_EMAIL'] = $ticket['email'];
		$_SESSION['SESS_TEXT_MSG'] = $ticket['title'];
		$_SESSION['SESS_BESCHR_MSG'] = $ticket['description'];
		$_SESSION['SESS_PRIO'] = $ticket['priority'];
		$_SESSION['SESS_TIME_STAMP'] = $ticket['timestamp'];
		$_SESSION['SESS_STATUS'] = $ticket['status'];
		session_write_close();
		//header("location: ticketuebersicht.php");
		//exit();
	}
}

?>
<center><table width="647" height="26" border="1">
  <tr>
    <th scope="col"><?php $ticket['ticket_id'];?></th>
    <th scope="col"><?php $_SESSION['SESS_TIME_STAMP']?></th>
    <th scope="col"><?php $_SESSION['SESS_STATUS']?></th>
    <th scope="col"><?php $_SESSION['SESS_TEXT_MSG']?></th>
    <th scope="col"><?php $_SESSION['SESS_PRIO']?></th>
  </tr>
</table></center>

Link to comment
https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197340
Share on other sites

For those unfamiliar with the German language:

 

ticketuebersicht.php is ticketoverview.php

 

@OP

 

if(mysql_num_rows($result) == 1) {

 

That's your problem. It will work if their is only one record in your database, but as soon you have multiple tickets it won't work anymore, replace it with:

 

if($result && mysql_num_rows($result)) { // if $result != equal any false value & > 0 rows were found
    while($row = mysql_fetch_assoc($result)) { // loop until the last row
        //<td>..</td>
    }
}

Link to comment
https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197343
Share on other sites

something like that ?

 

$qry="SELECT * FROM newticket";
$result=mysql_query($qry);

if($result && mysql_num_rows($result)) { // if $result != equal any false value & > 0 rows were found
    while($row = mysql_fetch_assoc($result)) { // loop until the last row
    	session_regenerate_id();
		$ticket = mysql_fetch_assoc($result);
		$_SESSION['SESS_TICKET_ID'] = $ticket['ticket_id'];
		$_SESSION['SESS_FIRST_NAME'] = $ticket['fname'];
		$_SESSION['SESS_LAST_NAME'] = $ticket['lname'];
		$_SESSION['SESS_TEL'] = $ticket['tel'];
		$_SESSION['SESS_EMAIL'] = $ticket['email'];
		$_SESSION['SESS_TEXT_MSG'] = $ticket['title'];
		$_SESSION['SESS_BESCHR_MSG'] = $ticket['description'];
		$_SESSION['SESS_PRIO'] = $ticket['priority'];
		$_SESSION['SESS_TIME_STAMP'] = $ticket['timestamp'];
		$_SESSION['SESS_STATUS'] = $ticket['status'];
		session_write_close();

		<center><table width="647" height="26" border="1">
  <tr>
    <th scope="col"><?php $ticket['ticket_id'];?></th>
    <th scope="col"><?php $_SESSION['SESS_TIME_STAMP']?></th>
    <th scope="col"><?php $_SESSION['SESS_STATUS']?></th>
    <th scope="col"><?php $_SESSION['SESS_TEXT_MSG']?></th>
    <th scope="col"><?php $_SESSION['SESS_PRIO']?></th>
  </tr>
</table></center>
    	

        //<td>..</td>
    }
}

Link to comment
https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197406
Share on other sites

alright then,

 

but what to fill in the table tags with?

 

this:

<center><table width="647" height="26" border="1">
  <tr>
    <th scope="col"><?php $ticket['ticket_id'];?></th>
    <th scope="col"><?php $_SESSION['SESS_TIME_STAMP']?></th>
    <th scope="col"><?php $_SESSION['SESS_STATUS']?></th>
    <th scope="col"><?php $_SESSION['SESS_TEXT_MSG']?></th>
    <th scope="col"><?php $_SESSION['SESS_PRIO']?></th>
  </tr>
</table></center>

 

to:

???

 

i'm really sorry for being so annoying,

i'm very willing to learn ;-)

 

 

Link to comment
https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197418
Share on other sites

FYI looks like this now:

 

echo "<tr>";
    	echo '<td scope="col"> ' .$row['ticket_id']. "</td>";
    	echo '<td scope="col"> ' .$row['timestamp']. "</td>";
    	echo '<td scope="col"> ' .$row['status']. "</td>";
    	echo '<td scope="col"> ' .$row['title']. "</td>";
    	echo '<td scope="col"> ' .$row['priority']. " </td>";
    	echo '<a href="ticketdetails.php='.$row['ticket_id'].'">show Calldetails!</a>';
    	echo '</tr></br>';

 

How can i bring them into defined tables?

Link to comment
https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197911
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.