skis Posted October 20, 2006 Share Posted October 20, 2006 I'm beginning to write an IT help request form to better learn how to interact with php and mysql. here is my code:queue.php:<?php//queue for techsrequire("connect.php");$query = "SELECT id, time, username, summary FROM itrequest";$result = mysql_query($query);while(list($id, $time, $username, $summary)= mysql_fetch_row($result)){ echo "<tr>" . "<td><input type=\"checkbox\" value=\"".$id."\" name=\"check".$id."\"></td>" . "<td>$id</td>" . "<td>$time</td>" . "<td>$username</td>" . "<td>$summary</td>";}---------------------------------------------------------------ticket.php (where you go after you check the boxes next to the tickets you want to view and click submit button):<?php//used to view details of ticket(s)require("connect.php");$_POST = array_flip($_POST);foreach($_POST as $checked => $box){ if($box != "NULL"){ $qid = "SELECT id FROM itrequest WHERE id = $checked"; $qdate = "SELECT date FROM itrequest WHERE id = $checked"; $qusername = "SELECT username FROM itrequest WHERE id = $checked"; $qsummary = "SELECT summary FROM itrequest WHERE id = $checked"; $qdescription = "SELECT description FROM itrequest WHERE id = $checked"; $id = mysql_query($qid) or die("could not get id from mysql"); $thedate = mysql_query($qdate) or die("could not get date from mysql"); $username = mysql_query($qusername) or die("could not get username from mysql"); $summary = mysql_query($qsummary) or die("could not get summary from mysql"); $description = mysql_query($qdescription) or die("could not get description from mysql"); echo "Ticket ID: $id <br> Date: $thedate <br> Username: $username <br> Summary: $summary <br> Description: $description"; }}?>------------------------------------------------------------------Instead of getting Ticket #: <ticket number here>I am getting Ticket #: Resource #16 and other numbers like thatCan anyone see what I am doing wrong? Link to comment Share on other sites More sharing options...
tleisher Posted October 20, 2006 Share Posted October 20, 2006 When you do a query, you're actually getting a reference to the results, you then have to process those results like so:$id = mysql_query($qid) or die("could not get id from mysql");$query = mysql_fetch_array($id);$ticketNumber = $query["id"];echo "Ticket Number: " . $ticketNumber; Link to comment Share on other sites More sharing options...
skis Posted October 20, 2006 Author Share Posted October 20, 2006 thanks a lot, now it all makes sense Link to comment Share on other sites More sharing options...
Recommended Posts