<style>  font-size: 14px;
    font-weight: normal;
    font-family: Tahoma, Geneva, sans-serif;
}
.bar {
    font:"Free 3 of 9 Extended";
    font-size:14px;
}

.K2 {
    font-size: 14px;
    font-family: tahoma, Geneva, sans-serif;
}
.ff {
    font-family: "Courier New", Courier, monospace;
}
-->
</style>


<?php  
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("shipments", $con);
$term = $_POST['term'];
$results = mysql_query("select * from info where user like '%$term%'");
  
while ($result = mysql_fetch_array($results)) {  
$id = $result['id'];  
$to = $result['to'];  
$wgt = $result['wgt'];  
$user = $result['user'];  
$price = $result['price'];  
$item = $result['item'];  
 

echo '

<table align="left">
  <tr>
    <td>
      <table width="97%" align="center" background="ss.jpg">
        <tr>
          <td width="68%">SHIPID: '.$id.'</td>
          <td width="32%" class="ff">CONTENTS:'.$item.'</td>
        </tr>
      </table>

      <table>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table>
      <table width="800" align="center">
        <tr>
        <td class="K"><strong><U>SEND TO :</U></strong></td>
        <td class="K2">&nbsp;</td>
        <td class="K" align="right"><strong>FROM :</strong></td>
        <td class="K2">&nbsp;</td>
      </tr>
      <tr>
        <td width="12%" height="131" class="K">&nbsp;</td>
        <td align="justify" width="34%" class="K2"><table width="250">
            <tr>
              <td class="K2" style="text-transform:uppercase"><strong><br />'.(nl2br ($to)).'</strong></td>
              </tr>
          </table>         </td>
        <td width="14%" class="K" align="center"><p>::</p>
          <p>::</p>
          <p>::</p>
          <p>::</p></td>
        <td align="justify" width="40%" class="K2">&nbsp;</td>
      </tr>
      <tr>
        <td height="16" class="K">------------------</td>
        <td class="K2">--------------------------------------------------</td>
        <td class="K">---------------------</td>
        <td class="K">--------------------------------------------------------</td>
      </tr>
    </table>
      <table width="72%" align="center">
        <tr>
          <td align="center"><span style="font:Verdana, Geneva, sans-serif; font-size: 10px;"> :: Package Information :: </span></td>
        </tr>
      </table>
      <table  width="72%" align="center" >
        <tr align="left">
          <td width="11%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" height="20">*Content:</td>
          <td width="28%"  class="K2">PhotoGraphy Acc.</td>
          <td width="8%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;">*Weight:</td>
          <td width="31%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" class="K2">'.$wgt.' grams</td>
          <td width="9%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" class="K"><p>*Price:</td>
          <td width="13%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" class="K2"><span class="K2" style="font:Verdana, Geneva, sans-serif; font-size: 10px;">'.$price.' USD</span></td>
          <td width="13%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" class="K2" align="right">UID</td>
          <td width="13%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" class="K2"><strong>'.$user'</strong></td>
        </tr>
      </table>
    <hr color="#CCCCCC" />
    <table width="100%">
      <tr>
        <td width="57%" height="67"><p>Item ID:</p>
          '.$itemid.'</td>
        <td width="43%"><p>Tracking Code:</p>
          <p>&nbsp;</p></td>
      </tr>
    </table></td>
  </tr>
</table> ';
}
?>

I am using above script but it gives me an error

Parse error: parse error, expecting `','' or `';'' in C:\wamp\www\print.php on line 107

Recommended Answers

All 5 Replies

Hey there!

on line 100:

<td width="13%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" class="K2"><strong>'.$user'</strong></td>

you forgot to put a full stop at the end of the variable.

<td width="13%" style="font:Verdana, Geneva, sans-serif; font-size: 10px;" class="K2"><strong>'.$user.'</strong></td>

HEy Thanx ! But now the new problem is. When I search for anything, it simply shows the blank page and when I do not enter anything, it shows all the data from Mysql.

What to do now? :(

Ok I figured it out. When I seach for something which is not presend in ID column of Database then it gives an error page. What can I do if the item searched is not available in Database?

what does the error page do?

have you tried abit of error handling? (if/else statements);

does the error stop the whole page or do you just get a block in a table with errors?

on line 100 you are missing a '.':

<strong>'.$user'</strong></td>

it should be:

<strong>'.$user.'</strong></td>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.