Blarg1988 Posted April 5, 2011 Share Posted April 5, 2011 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] Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/ Share on other sites More sharing options...
Blarg1988 Posted April 5, 2011 Author Share Posted April 5, 2011 nobody? Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197295 Share on other sites More sharing options...
Nuxius Posted April 5, 2011 Share Posted April 5, 2011 Wait sorry misunderstod sorry, Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197302 Share on other sites More sharing options...
Blarg1988 Posted April 5, 2011 Author Share Posted April 5, 2011 certainly! see the attachment [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197305 Share on other sites More sharing options...
Maq Posted April 5, 2011 Share Posted April 5, 2011 No one feels like downloading all those files. Post the code that relates to: 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. Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197327 Share on other sites More sharing options...
Blarg1988 Posted April 5, 2011 Author Share Posted April 5, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197340 Share on other sites More sharing options...
ignace Posted April 5, 2011 Share Posted April 5, 2011 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> } } Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197343 Share on other sites More sharing options...
Blarg1988 Posted April 5, 2011 Author Share Posted April 5, 2011 thanks for the translation and for your hint! what do i need to fill in between <td></td>? The table how the tickets are shown in this overview? Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197350 Share on other sites More sharing options...
Blarg1988 Posted April 5, 2011 Author Share Posted April 5, 2011 anyone knows any other solution? i'd be really grateful Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197382 Share on other sites More sharing options...
ignace Posted April 5, 2011 Share Posted April 5, 2011 Between <td></td> comes your actual ticket information, I thought you could figure that out by yourself. Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197393 Share on other sites More sharing options...
Blarg1988 Posted April 5, 2011 Author Share Posted April 5, 2011 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> } } Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197406 Share on other sites More sharing options...
ignace Posted April 5, 2011 Share Posted April 5, 2011 Yes, but you don't need session_regenerate_id() and $_SESSION in it. Sessions are to store certain values between page views. Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197414 Share on other sites More sharing options...
Blarg1988 Posted April 5, 2011 Author Share Posted April 5, 2011 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 ;-) Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197418 Share on other sites More sharing options...
ignace Posted April 6, 2011 Share Posted April 6, 2011 http://php.net/mysql-fetch-assoc Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197598 Share on other sites More sharing options...
Blarg1988 Posted April 6, 2011 Author Share Posted April 6, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/232764-help-tickettool-php/#findComment-1197911 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.