pass value in javascript function along with php - php

echo "
<table class='productNeedTb'>
<tr>
<td >{$row['O_no']}</td>
<td style='color:{$statusColor};'>{$row['Status']}</td>
<td>{$row['Product']}</td>
<td>{$row['Quantity']}</td>
<td>{$row['Price']}</td>
<td>{$row['Place']}</td>
<td>{$row['Fee']}</td>
<td>{$row['Dest']}</td>
<td>{$row['ExpeTime']}</td>
<td>{$row['OtherNeed']}</td>
<td>{$row['Req_date']}</td>
<td><button name='IcanBtn' type='submit' class='IcanBtn' onclick='showHelper(`{$row['O_no']}`, `{$row['Product']}`, `{$row['Quantity']}`, `{$row['Price']}`, `{$row['Place']}`, `{$row['Fee']}`, `{$row['Dest']}`, `{$row['ExpeTime']}`, `{$row['OtherNeed']}` )'>我要接單!</button></td>
</tr>
</table>
<br>
";
I wrote an php code but in the last td we have button with a function showHelper() which is supposed to pass value to the function and do something else.
and this is thw erroe that I got :
麥當勞大麥克 undefined undefined undefined undefined undefined undefined undefined undefined
I know the problem would be in {$row['O_no']}, {$row['Product']} the ,here but I just can't fix it.
I tried to pass it without quotes but it sees it as a variable but it's supposed to be string so error occur so I tried to make them all string and using "" or '' cause some sort problem as well
if(isset($_SESSION['u_uid']))
{
//create a prepared statement
$sql="SELECT Status, O_no, Product, Quantity, Price, Place, Fee, Dest, ExpeTime, OtherNeed, Req_date FROM productneeds WHERE Status='等待中' or Status='進行中' ORDER BY O_no DESC;";
$exe=mysqli_query($conn, $sql);
$exeChk=mysqli_num_rows($exe);
if($exeChk>0)
{
echo "
<table class='productNeedTb'>
<tr>
<td>訂單No.</td>
<td>狀態</td>
<td>物品</td>
<td>物品數量</td>
<td>物品單價</td>
<td>購買地點</td>
<td>願意支付跑腿費</td>
<td>送達地點</td>
<td>期望送達時間</td>
<td>特殊要求</td>
<td>提出時間</td>
<td></td>
</tr>
</table>
<br>
";
while($row=mysqli_fetch_assoc($exe))
{
//$p_info=[$row['O_no'],$row['Product'],$row['Quantity'],$row['Price'],$row['Place'],$row['Fee'],$row['Dest'],$row['ExpeTime'],$row['OtherNeed']];
if($row['Status']=="等待中")
{
$statusColor="red";
echo "
<table class='productNeedTb'>
<tr>
<td >{$row['O_no']}</td>
<td style='color:{$statusColor};'>{$row['Status']}</td>
<td>{$row['Product']}</td>
<td>{$row['Quantity']}</td>
<td>{$row['Price']}</td>
<td>{$row['Place']}</td>
<td>{$row['Fee']}</td>
<td>{$row['Dest']}</td>
<td>{$row['ExpeTime']}</td>
<td>{$row['OtherNeed']}</td>
<td>{$row['Req_date']}</td>
<td>
<button name='IcanBtn' type='submit' class='IcanBtn' onclick='showHelper(\" " . $row['O_no'] . " \", \" " . $row['Product'] . " \",\"" . $row['Quantity'] . "\",\"" . $row['Price'] . "\",\"" . $row['Place'] . "\",\"" . $row['Fee'] . "\",\"" . $row['Dest'] . "\",\"" . $row['ExpeTime'] . "\",\"" . $row['OtherNeed'] . "\")'>我要接單!</button>
</td>
</tr>
</table>
<br>
";
}

The reason why your attempt was unsuccessful was because javascript saw your parameters as javascript variables hence the undefined error.
To fix your issue, i wrapped the variables around quotes and escaped to prevent them from being seen as javascript variables
<td><button name='IcanBtn' type='submit' class='IcanBtn' onclick='showHelper(\"" . $row['O_no'] . "\",\"" . $row['Product'] . "\",\"" . $row['Quantity'] . "\",\"" . $row['Price'] . "\",\"" . $row['Place'] . "\",\"" . $row['Fee'] . "\",\"" . $row['Dest'] . "\",\"" . $row['ExpeTime'] . "\",\"" . $row['OtherNeed'] . "\")'>我要接單!</button></td>

Related

How to show more info of the table

I have table with informations from database. There are ID, Name, Subject and Date. And I want to show more data like Message, OS, IP etc. when I click on one line (tr) of table. I found solution, but it is woking only on the first tr, not all.
Here is my code:
while($row = $result->fetch_assoc())
{
$id=$row['ID'];
$name=$row['Name'];
$mail=$row['Email'];
$subject=$row['Subject'];
$message=$row['Message'];
$date=$row['Date'];
$ip=$row['IP'];
$device=$row['Device'];
$os=$row['OS'];
$browser=$row['Browser'];
$finish=$row['Finish'];
echo
'<tr class="trX" id="flip">
<td class="tdX">' . $id . '</td>
<td class="tdX">' . $name . '</td>
<td class="tdX">' . $subject . '</td>
<td class="tdX">' . $date . '</td>
<div id="panel">
ID:' . $id . '
Name:' . $name . '
Email:' . $mail . '
Subject:' . $subject . '
Message:' . $message . '
Date:' . $date . '
IP:' . $ip . '
Mobile:' . $device . '
OS:' . $os . '
Browser:' . $browser . '
Finish:' . $finish . '
</div>
</tr>';
}
echo ' </table> ';
And JS Query
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("slow");
});
});
Thanks for tips
It's only working on first tr because you can not reuse the ID flip for other elements. Few solutions I can think of:
Have a variable which increments and assign it to the id like flip-i, i here is the incrementing variable. Attach click event to this and then toggle the child elements.
Attach click event to a class and then toggle children of that clicked class.
I changed your code this way:
<tr class="trX" id="flip_".$i onclick="flippanel($i)">
<td class="tdX">' . $id . '</td>
<td class="tdX">' . $name . '</td>
<td class="tdX">' . $subject . '</td>
<td class="tdX">' . $date . '</td>
<div id="panel_".$i>
ID:' . $id . '
Name:' . $name . '
Email:' . $mail . '
Subject:' . $subject . '
Message:' . $message . '
Date:' . $date . '
IP:' . $ip . '
Mobile:' . $device . '
OS:' . $os . '
Browser:' . $browser . '
Finish:' . $finish . '
</div>
</tr>
In jQuery you can call this like
function flippanel(i)
Then you can access panel by individual ID easily

PHP looping out records within seperate JQuery accordions

I have the following MySQL query:
$query_waitingrooms = "SELECT * FROM waitingroom, waitingroom_case_lookup, vcase, patient WHERE vcase.patient_fk = patient.patient_pk AND waitingroom.waitingroom_pk = waitingroom_case_lookup.waitingroom_fk AND vcase.case_pk = waitingroom_case_lookup.case_fk AND vcase.active = 'y' AND vcase.case_pk NOT IN (SELECT case_fk FROM user_case_lookup WHERE user_id = '$user_id')";
$result_waitingrooms = mysql_query($query_waitingrooms, $connection) or die(mysql_error());
The result is printed:
while ($row_waitingrooms = mysql_fetch_assoc($result_waitingrooms)){
echo "<h6>" . $row_waitingrooms['waitingroom'] . "</h6><div><p><span class='text'><table width='100%'><tr><td><input name='case' id='case_" . $row_waitingrooms['case_pk'] . "' type='radio' value='" . $row_waitingrooms['case_pk'] . "' /></td><td width='65' align='left'><div class='case_list'><img src='images/case_icons/" . $row_waitingrooms['patient_icon'] . "' width='44' height='45' /></div></td><td width='350' align='left'>" . $row_waitingrooms['first_name'] . ' ' . $row_waitingrooms['last_name'] . ' &nbspGender: ' . $row_waitingrooms['gender'] . ' Age: ' . $row_waitingrooms['age'] . '<br />Presenting Complaint: ' . $row_waitingrooms['presenting_complaint'] . "</td></tr></table></p></div>";
}
As expected, this results in an accordion for each of the records in table 'waitingroom_case_lookup' containing one 'case' per accordion. What I'm after is to have an accordion for each 'waitingroom' and each containing the relevant case data from the tables vcase and patient.
At the moment the table 'waitingroom_case_lookup' is:
CREATE TABLE waitingroom_case_lookup (
waitingroom_case_lookup_pk int(9) NOT NULL AUTO_INCREMENT,
waitingroom_fk int(3) NOT NULL,
case_fk int(3) NOT NULL,
PRIMARY KEY (waitingroom_case_lookup_pk)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'waitingroom_case_lookup'
--
INSERT INTO waitingroom_case_lookup (waitingroom_case_lookup_pk, waitingroom_fk, case_fk) VALUES
(1, 1, 1),
(2, 1, 2),
(3, 2, 3);
It would appear that I need to loop out the cases in each of the accordion waitingrooms between <span class='text'> and </p></div> Any suggestions how I can do this?
EDIT
Thanks to NoBBY I have the following working code (still need to clean it up re formatting...):
<?php
while ($row_waitingrooms = mysql_fetch_assoc($result_waitingrooms)){
$waitingRoomPK = $row_waitingrooms['waitingroom_pk'];
if (!isset($waitingRooms[$waitingRoomPK])) {
$waitingRooms[$waitingRoomPK] = array(
'waitingroom_pk' => $waitingRoomPK,
'waitingroom' => $row_waitingrooms['waitingroom'],
'cases' => array()
);
}
$waitingRooms[$waitingRoomPK]['cases'][] = array(
'case_pk' => $row_waitingrooms['case_pk'],
'patient_icon' => $row_waitingrooms['patient_icon'],
'first_name' => $row_waitingrooms['first_name'],
'last_name' => $row_waitingrooms['last_name'],
'age' => $row_waitingrooms['age']
);
echo "<h6>" . $row_waitingrooms['waitingroom'] . "</h6><div><p><span class='text'>";
foreach ($waitingRooms[$waitingRoomPK]['cases'] as $wcase){
echo "<table width='100%'><tr><td><input name='case' id='case_" . $wcase['case_pk'] . "' type='radio' value='" . $wcase['case_pk'] . "' /></td><td width='65' align='left'><div class='case_list'><img src='images/case_icons/" . $wcase['patient_icon'] . "' width='44' height='45' /></div></td><td width='350' align='left'>" . $wcase['first_name'] . ' ' . $wcase['last_name'] . ' &nbspGender: ' . $wcase['gender'] . ' Age: ' . $wcase['age'] . '<br />Presenting Complaint: ' . $wcase['presenting_complaint'] . "</td></tr></table>";
}
echo "</span></p></div>";
}
?>
Instead of directly ouputting the result from the database try formatting i t first.
For example you can do something like that:
$waitingRooms = array();
while ($row_waitingrooms = mysql_fetch_assoc($result_waitingrooms)){
$waitingRoomPK = $row_waitingrooms['waitingroom_pk'];
if (!isset($waitingRooms[$waitingRoomPK])) {
$waitingRooms[$waitingRoomPK] = array(
'waitingroom_pk' => $waitingRoomPK,
'waitingroom' => $row_waitingrooms['waitingroom'],
'cases' => array(),
//.....all the data for a waitingroom
);
}
$waitingRooms[$waitingRoomPK]['cases'][] = array(
'case_pk' => $row_waitingrooms['case_pk'],
'patient_icon' => $row_waitingrooms['patient_icon'],
'first_name' => $row_waitingrooms['first_name'],
//.......all the data for a patient
);
}
Now $waitingRooms is array with data for each waiting room, and a 'cases' subarray with data for each patient in the room
From here 2 simple nested foreach statements will output the desired html for the accordions
Here is some ways to improve your code though:
Do not use mysql_* functions, they are deprecated. Those huge red warnings in the docs are not just for looks. User mysqli or PDO (both linked in the docs)
Use actual joins, that alternative join syntax in the query hurts readability
Format your sql and html code. I bet lots of people skipped your question when they saw these horisontal scrollbars in the code segments
I hope you will agree that that:
<?php while($row_waitingrooms = mysql_fetch_assoc($result_waitingrooms)): ?>
<h6><?= $row_waitingrooms['waitingroom']; ?></h6>
<div>
<p>
<span class='text'>
<table width='100%'>
<tr>
<td>
<input name='case' id='case_<?= $row_waitingrooms['case_pk']; ?>' type='radio' value='<?= $row_waitingrooms['case_pk']; ?>' />
</td>
<td width='65' align='left'>
<div class='case_list'>
<img src='images/case_icons/<?= $row_waitingrooms['patient_icon']; ?>' width='44' height='45' />
</div>
</td>
<td width='350' align='left'>
<?= $row_waitingrooms['first_name'] . ' ' . $row_waitingrooms['last_name']; ?>
Gender: <?= $row_waitingrooms['gender']; ?>
Age: <?= $row_waitingrooms['age']; ?>
<br />
Presenting Complaint: <?= $row_waitingrooms['presenting_complaint']; ?>
</td>
</tr>
</table>
</p>
</div>
<?php endwhile; ?>
is way better than that:
while ($row_waitingrooms = mysql_fetch_assoc($result_waitingrooms)){
echo "<h6>" . $row_waitingrooms['waitingroom'] . "</h6><div><p><span class='text'><table width='100%'><tr><td><input name='case' id='case_" . $row_waitingrooms['case_pk'] . "' type='radio' value='" . $row_waitingrooms['case_pk'] . "' /></td><td width='65' align='left'><div class='case_list'><img src='images/case_icons/" . $row_waitingrooms['patient_icon'] . "' width='44' height='45' /></div></td><td width='350' align='left'>" . $row_waitingrooms['first_name'] . ' ' . $row_waitingrooms['last_name'] . ' &nbspGender: ' . $row_waitingrooms['gender'] . ' Age: ' . $row_waitingrooms['age'] . '<br />Presenting Complaint: ' . $row_waitingrooms['presenting_complaint'] . "</td></tr></table></p></div>";
}
And you get the bonus to see the unclosed span tag :)

PHP- How do you split up an array of different rows thats been put in as one?

I'm trying to make a shopping cart and have managed to submit what checkboxes a user has checked to my shopping cart page. It echos the details from the database but I've realised that I cant get my details to post through on their own.
There is one big group, is there a way to add to my code to ungroup them and put them in a table?
this is the code ive used to post the deatils to my cart:
<?php
if (isset($_POST['games'])) {
$n = count($_POST['games']);
for($i=0; $i < $n; $i++)
echo $_POST['games'][$i];
}
?>
this is the database:
<?php
$con = pg_connect(bla bla);
if (!$con){
die('Could not connect: ' . pg_error());
}
$result = pg_query("SELECT * FROM CSGames");
echo "
<table>
<tr>
<th>Title</th>
<th>Platform</th>
<th>Description</th>
<th>Price</th>
<th>Select</th>
</tr>";
while($row = pg_fetch_array($result)){
echo"<tr>";
echo "<td>" . $row['1'] . "</td>";
echo "<td>" . $row['2'] . "</td>";
echo "<td>" . $row['3'] . "</td>";
echo "<td>" . $row['4'] . "</td>";
echo '<td><input type="checkbox" name="games[]" value="' . $row['0'] . $row['1'] . $row['2'] . $row['3'] . $row['4'] . '"/></td>';
echo"</tr>";
}
echo"</table>";
pg_close($con);
?>
The problem with the data you are getting from $_POST['games'] lies in how you are populating the 'value' property of the input.
While personally I would add a game ID to your database table and only put the value of the game's ID as the input's value and just look up the data for the selected games on your cart output page, I will stick with the framework within how you have done things for my answer.
This is your problem:
<input type="checkbox" name="games[]" value="' . $row['0'] . $row['1'] . $row['2'] . $row['3'] . $row['4'] . '"/>
Here you are just concatenating a bunch of strings together without any sort of separator that you can later split on. I would simply suggest doing something like this:
<input type="checkbox" name="games[]" value="' . $row['0'] . '|||' . $row['1'] . '|||' . $row['2'] . '|||'. $row['3'] . '|||' . $row['4'] . '"/>
I have added triple pipes ||| that you can later use to split these fields on.
So when you get to outputting, you can do something like this:
<?php
if (isset($_POST['games'])) {
?>
<table>
<tr>
<tr>
<th>Title</th>
<th>Platform</th>
<th>Description</th>
<th>Price</th>
</tr>
<?php
foreach($_POST['games'] as $game_string) {
$game = explode('|||', $game_string);
?>
<tr>
<?php
foreach ($game as $attr) {
?>
<td><?php echo $attr; ?></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
}
?>

Eliminating space between table data

I am trying to get rid of the border space between the cells. I thought cellspacing would do the trick but there is still a slim white border. Can anyone give me some advice...
<body>
<center><table style="cellspacing:0; width:400px; border:none;">
<?
echo "<tr><td> Team </td><td>Correct Picks</td><td>Points</td></tr>";
while($row = mysql_fetch_array($memberslist)) {
if ($row['User_ID'] == $id) {
echo "<tr bgcolor=\"gray\"><td>" . $row['User_ID'] . "</td><td><b>" . $row['Correct_Picks'] . " </b> /" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
} else {
echo "<tr><td>" . $row['User_ID'] . "</td><td><b>" . $row['Correct_Picks'] . " </b> /" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
}
}
?>
</table></center>
</body>
cellspacing=0;
is no CSS. That was once a HTML attribute:
<table cellspacing="0" style="width:400px">
See as well the related (duplicate?) question:
How to set cellpadding & cellspacing in CSS?

What am i doing wrong here?

I've been staring at this page for over an hour. My update function just doesnt not seem to update. When i tried it through sql it seems ok. I have a form at the bottom of this page which updates a field in a table. Can anyone spot the mistakes?
<?php
// First of all initialise the user and check for permissions
require_once "/var/www/users/user.php";
$user = new CHUser(2);
// Initialise the template
require_once "/var/www/template/template.php";
$template = new CHTemplate();
// And create a cid object
require_once "/var/www/Testing/DisplayWIPOnLocation.php";
$BundleProgress= new CHWIPProgress();
if(isset($_GET['Reference'])){
$todays_date = date("Y-m-d H:i:s");
$content .= " <h3> Details for Bundle : $reference </h3> ";
$bundle = $BundleProgress->GetBundle($_GET['Reference']);
$reference = $_GET['Reference'];
// Now show the details
foreach($bundle as $x){
$content .= "
<table>
<tr>
<th> Location </th>
<td>" . $x['Description'] . "</td>
</tr>
<tr>
<th> Works Order Number </th>
<td>" . $x['WorksOrder'] . "</td>
</tr>
<tr>
<th> Bundle Number </th>
<td>" . $x['Number'] . "</td>
</tr>
<tr>
<th>Qty Issued</th>
<td>" . $x['Qty'] . "</td>
</tr>
<tr>
<th>Bundle Reference </th>
<td>" . $x['Reference'] . "</td>
</tr>
<tr>
<th>Style description</th>
<td>" . $x['Stock'] . "</td>
</tr>
<tr>
<th>Due Date</th>
<td>" . $x['DueDate'] . "</td>
</tr>
<tr>
<th>Date In </th>
<td>" . $x['DateIN'] . "</td>
</tr>
<tr>
<th>Date Out</th>
<td>" . $x['DateOUT'] . "</td>
</tr>
<tr>
<th>Last Code</th>
<td>" . $x['Last'] . "</td>
</tr>
</table>
<br> ";
}
$content .= " </table>
<form action='viewBundle.php?step=2' method='post'>
<p>Reason: <input type='text' name='reason' /><br
/><p>
<p><input type='hidden' name='bundlereference'
id='Username' value='" . $x['Reference'] . "' />
<input type='submit' name ='add'/></form>
</table> ";
if($_GET['step'] == 2) {
$BundleProgress->UpdateReason($_POST['reason'],$_POST['bundlereference']);
$content .= " <a href='index.php?location=" .
$x['Description'] . "'> updated</a> ";
}
}
else {
$content .= "<h3>Something has gone wrong</h3>
<br>
<a href='index.php?location=" . $x['Description'] . "'> Return to Previous
Page </a>
";
}
$template->SetTag("content", $content);
echo $template->Display();
?>
Function
public function UpdateReason($reason, $bundlereference) {
$sql = "UPDATE `ArchiveBundle`
SET `Issue` = " . $reason . "
WHERE `BundleReference` = " . $bundlereference .
";";
mysql_select_db(DB_DATABASE_NAME, $this->conn);
return mysql_query($sql, $this->conn);
}
change:
if($_GET['step'] == 2)
to:
if((int)$_GET['step'] === 2)
and:
public function UpdateReason($reason, $bundlereference) {
$sql = "UPDATE `ArchiveBundle`
SET `Issue` = " . $reason . "
WHERE `BundleReference` = " . $bundlereference .
";";
mysql_select_db(DB_DATABASE_NAME, $this->conn);
return mysql_query($sql, $this->conn);
}
to:
public function UpdateReason($reason, $bundlereference) {
mysql_select_db(DB_DATABASE_NAME, $this->conn);
$_reason = mysql_real_escape_string($reason,$this->conn);
$_bundlereference = mysql_real_escape_string($bundlereference,$this->conn);
$sql = "UPDATE `ArchiveBundle`
SET `Issue` = '" . $_reason . "'
WHERE `BundleReference` = '" . $_bundlereference . "'";
return mysql_query($sql, $this->conn);
}
Try that. Code hasn't been tested but it's a good place to start.
To try and debug what's going on here do the following:
public function UpdateReason($reason, $bundlereference) {
error_reporting(E_ALL ^ E_NOTICE);
$db_selected = mysql_select_db(DB_DATABASE_NAME, $this->conn);
if (!$db_selected) {
die("Can't use db : " . mysql_error());
}
$_reason = mysql_real_escape_string($reason,$this->conn);
$_bundlereference = mysql_real_escape_string($bundlereference,$this->conn);
$sql = "UPDATE `ArchiveBundle`
SET `Issue` = '" . $_reason . "'
WHERE `BundleReference` = '" . $_bundlereference . "'";
mysql_query($sql, $this->conn);
die(mysql_error());
}
Also, it looks like on your form submission you're not passing in the Reference parameter so the if(isset($_GET['Reference'])) will fail when you post the form. I've change the table and form code below to make it more readable, pass in the Reference param on form submission, and also to update the db record BEFORE fetching the dataset so you'll see the updated records in the table returned.
// First of all initialise the user and check for permissions
require_once "/var/www/users/user.php";
$user = new CHUser(2);
// Initialise the template
require_once "/var/www/template/template.php";
$template = new CHTemplate();
// And create a cid object
require_once "/var/www/Testing/DisplayWIPOnLocation.php";
$BundleProgress= new CHWIPProgress();
if(isset($_GET['Reference'])){
if($_GET['step'] == 2) {
$BundleProgress->UpdateReason($_POST['reason'],$_POST['bundlereference']);
}
$todays_date = date("Y-m-d H:i:s");
$content .= " <h3> Details for Bundle : $reference </h3> ";
$bundle = $BundleProgress->GetBundle($_GET['Reference']);
$reference = $_GET['Reference'];
// Now show the details
foreach($bundle as $x){
$content .= "
<table>
<tr><th> Location </th><td>" . $x['Description'] . "</td></tr>
<tr><th> Works Order Number </th><td>" . $x['WorksOrder'] . "</td></tr>
<tr><th> Bundle Number </th><td>" . $x['Number'] . "</td></tr>
<tr><th>Qty Issued</th><td>" . $x['Qty'] . "</td></tr>
<tr><th>Bundle Reference </th><td>" . $x['Reference'] . "</td></tr>
<tr><th>Style description</th><td>" . $x['Stock'] . "</td></tr>
<tr><th>Due Date</th><td>" . $x['DueDate'] . "</td></tr>
<tr><th>Date In </th><td>" . $x['DateIN'] . "</td></tr>
<tr><th>Date Out</th><td>" . $x['DateOUT'] . "</td></tr>
<tr><th>Last Code</th><td>" . $x['Last'] . "</td></tr>
</table>
<br>";
}
$content .= "<table>
<form action='viewBundle.php?Reference=" . $_GET['Reference'] . "&step=2' method='post'>
<p>Reason: <input type='text' name='reason' /></p><br/>
<p><input type='hidden' name='bundlereference' id='Username' value='" . $x['Reference'] . "' /></p>
<input type='submit' name ='add'/>
</form>
</table>";
} else {
$content .= "<h3>Something has gone wrong</h3>
<br>
<a href='index.php?location=" . $x['Description'] . "'> Return to Previous Page </a>
";
}
$template->SetTag("content", $content);
echo $template->Display();
Can I advise you break this down by first checking what mysql_query returns. It maybe that this particular variable is defined incorrectly. Also remember add quotes to the values in your query.

Categories