...

View Full Version : syntax error



eschuppe
05-10-2009, 07:08 AM
theres an syntax error at line 83( echo "<td align=\"left\"><a href='deletelink.php?id="$id"'>Delete</a></td><tr>\n"; )but in my php editor it shows the syntax as correct.

<link href="styles.css" rel="stylesheet" type="text/css">
<?php


include ('dbc.php'); // Connect to the data base.





$max = 10; //amount of articles per page. change to what to want

$p = $_GET['p'];

if(empty($p))

{

$p = 1;

}

$limits = ($p - 1) * $max;

//view the news article!

if(isset($_GET['act']) && $_GET['act'] == "view")

{

$id = $_GET['id'];

$sql = mysql_query("SELECT * FROM checkout WHERE id = '$id'");

while($r = mysql_fetch_array($sql))

{

$full_name = $r['full_name'];

$user_idnum = $r['user_idnum'];

$date = $r['date'];

$book = $r['book'];

$returned = $r['returned'];

echo "<div><p>$full_name</p><p>$user_idnum</p><p>$date</p><p>$book</p><p>$returned</p></div>";

}



}else{



$sql = mysql_query("SELECT full_name,user_idnum,DATE_FORMAT(`date`, '%m/%d/%Y %I:%i %p'),bookname,booknum,qualityc,returned,qualityr FROM checkout ORDER BY date DESC LIMIT ".$limits.",$max") or die(mysql_error());

//the total rows in the table

$totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM checkout"),0);

//the total number of pages (calculated result), math stuff...

$totalpages = ceil($totalres / $max);

//the table

echo '<table align="center" cellspacing="2" cellpadding="2"><tr><td align="left"><b>Name</b></td><td align="center"><b>ID</b></td><td align="center"><b>Date</b></td><td align="center"><b>Book Name</b></td><td align="center"><b>Book Number</b></td><td align="center"><b>Quality</b></td><td align="center"><b>Returned</b></td><td align="center"><b>Quality</b></td></tr><tr>';

while ($r = mysql_fetch_array($sql, MYSQL_NUM)) {
echo "<tr><td align=\"left\">" .
stripslashes($r[0]) . "</td>";
echo "<td align=\"left\">$r[1]</td>";
echo "<td align=\"left\">$r[2]</td>";
echo "<td align=\"left\">$r[3]</td>";
echo "<td align=\"left\">$r[4]</td>";
echo "<td align=\"left\">$r[5]</td>";
echo "<td align=\"left\">$r[6]</td>";
echo "<td align=\"left\">$r[7]</td>";
echo "<td align=\"left\"><a href='deletelink.php?id="$id"'>Delete</a></td><tr>\n";

}

}


//close up the table

echo "</tr></table>";

echo( "<div style='text-align: center;'>" );

for($i = 1; $i <= $totalpages; $i++){

//this is the pagination link

$counter = "<a href='usercheckoutsm.php?p=$i'>$i</a>";
echo "<span class=\"csstables\">$counter</span>";

}

echo( "</div>" );


?>

Len Whistler
05-10-2009, 07:12 AM
You might be missing some escape characters. Try:


echo "<td align=\"left\"><a href=\"deletelink.php?id=$id\">Delete</a></td><tr>\n";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum