Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: syntax error

  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    25
    Thanks
    3
    Thanked 0 Times in 0 Posts

    syntax error

    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.
    PHP Code:
    <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($sqlMYSQL_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>" );


    ?>

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    You might be missing some escape characters. Try:

    PHP Code:
     echo "<td align=\"left\"><a href=\"deletelink.php?id=$id\">Delete</a></td><tr>\n"
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •