www.webdeveloper.com
Results 1 to 3 of 3

Thread: PHP Link code

  1. #1
    Join Date
    Feb 2011
    Posts
    43

    Exclamation PHP Link code

    hye..

    i am facing some problem in showing the link in my page. I try to alter but there are still error. So, i would like if someone can please help detect the error. Thanks in advance.

    here are my code:

    PHP Code:
    <?php
    $q
    =$_GET["q"];

    include(
    "connection.php");

    $sql="SELECT * FROM menu WHERE Category = '".$q."'";

    $result mysql_query($sql);

    echo 
    "<table border='1'>
    <tr>
    <th>    Menu    </th>
    <th>    Image    </th>
    <th>    Descriptions    </th>
    <th>    Price (RM)    </th>
    </tr>"
    ;

    while(
    $row mysql_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['Name'] . "</td>";
      echo 
    "<td><img src='" $row['Pic']  . "' height='119' width='148' /></td>";
      echo 
    "<td>" $row['Description'] . "</td>";
      echo 
    "<td>" $row['Price'] . "</td>";
      echo 
    "<td><a href="cart.php?action=add&id='".$row['id']."'>Add to cart"</a></td>";
      echo 
    "</tr>";
       }
    echo 
    "</table>";

    mysql_close($conn);
    ?>
    the error are:
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

  2. #2
    Join Date
    Mar 2009
    Posts
    452
    PHP Code:
    <?php 
    $q
    =$_GET["q"]; 

    include(
    "connection.php"); 

    $sql="SELECT * FROM menu WHERE Category = '".$q."'"

    $result mysql_query($sql); 

    echo 
    "<table border='1'> 
    <tr> 
    <th>    Menu    </th> 
    <th>    Image    </th> 
    <th>    Descriptions    </th> 
    <th>    Price (RM)    </th> 
    </tr>"


    while(
    $row mysql_fetch_array($result)) 
      { 
      echo 
    "<tr>"
      echo 
    "<td>" $row['Name'] . "</td>"
      echo 
    "<td><img src='" $row['Pic']  . "' height='119' width='148' /></td>"
      echo 
    "<td>" $row['Description'] . "</td>"
      echo 
    "<td>" $row['Price'] . "</td>"
      echo 
    "<td><a href='cart.php?action=add&id=".$row['id']."'>Add to cart</a></td>"
      echo 
    "</tr>"
       } 
    echo 
    "</table>"

    mysql_close($conn); 
    ?>

  3. #3
    Join Date
    Feb 2011
    Posts
    43
    oo..thanks..it works..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles