Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by AyKay47

  1. I will post the code that was pm'ed to me for other to see:

     

    <?php include("top.php");?>
       <?php                     
    $where="";
    if(isset($_POST['courier_no']))
    {
    $var=$_POST['courier_no'];
       
    $where=" AND A.courier_no LIKE '". $_POST['courier_no'] ."%'";
    }
    ?>
       <tr>
        <td class="content" valign="top">
             <table width="100%" border="0" align="right">
             <tr bordercolordark="#FF0000">
             <td align="center" colspan="2">
             <h2 align="center"><font color="#FF0033" size="5" face="Courier New">Your Courier Details</font></h2>
             </td>
             </tr>
             <table width="99%" align="right" style="border:solid 1px" class="nav_sel">
             <?php include("connect.php"); ?>
             <?php  
             $courier_id=0;
              $sql=("SELECT A.courier_id, A.courier_no , A.sender_name ,A.saddress,
                               B.location_name AS Sender_location  ,
                                A.reciever_name ,A.raddress ,
                               C.location_name  AS Reciever_location
                               FROM  courier_detail A,location   B,location  C
                                 WHERE A.location2 = B.location_id AND
                                    A.location_id = C.location_id AND A.isdelete=0 ".$where) ; 
                   $result =mysql_query($sql);              
             while($row = mysql_fetch_array($result))
               {
           $courier_id=$row['courier_id'];
               echo "<tr>";
             echo"<td height='31' colspan='1' align='center'><b>Courier No :</b></td>";
             echo"<td width='117' colspan='0'  bgcolor='#dce4ff'>". $row['courier_no'] ."</td>";
             echo "<td width='117'  height='29'></td>";
             echo "<td colspan='0' height='30' bgcolor='#dce4ff'></td>";
             echo "</tr>";
             echo "<tr>";            
             echo "<td width='100' height='34'><b> Sender Name :</b></td>";
             echo "<td width='117' bgcolor='#dce4ff'>". $row['sender_name'] ."</td>";
             echo "<td width='110'> <b>Reciever Name :</b></td>";
             echo "<td width='117'  bgcolor='#dce4ff'>". $row['reciever_name'] ."</td>";
             echo "</tr>";
             echo "<tr>";
             echo "<td height='29'><b>Sender Address :</b></td>";
             echo "<td  bgcolor='#dce4ff'>". $row['saddress'] ."</td>";
             echo "<td><b>Reciever Address :</b></td>";
             echo "<td  bgcolor='#dce4ff'>". $row['raddress'] ."</td>";
             echo "</tr>";
             
             echo "<tr>";            
             echo "<td height='29' width='135'><b>Sender Location :</b></td>";
             echo "<td width='70'  bgcolor='#dce4ff'>". $row['Reciever_location'] ."</td>";
             echo "<td width='135'><b>Reciever Location :</b></td>";
             echo "<td  bgcolor='#dce4ff'>". $row['Sender_location'] ."</td>";
             echo "</tr>";
              ?>
             <?php 
             echo "</td >" ;
             echo "</tr>";
             }
             
             echo "</table>";?><br />
                <h2 align="center"><font color="#FF0000" size="5" face="Courier New">Courier Tracking Details</font></h2>
             <table width="99%" border="0"align="right" style="border:solid 1px" class="nav_sel">
             
                <?php  
                   
             $sql ="SELECT A.remark, A.recieve_date, A.transit_id, 
                            B.location_name AS Forward_To, D.type_name AS Courier_Type,E.courier_no AS Courier_No,
                            C.status_name AS Status 
                            FROM transit A, location B,STATUS C,TYPE D,courier_detail E
                            WHERE A.location_id = B.location_id
                            AND A.status_id = C.status_id
                            AND A.type_id = D.type_id 
                            AND A.courier_id=E.courier_id AND E.courier_id=".$courier_id." order by recieve_date asc";
             $result1 =mysql_query($sql); 
             
             while($row1 = mysql_fetch_array($result1))
               {
             
               echo "<tr>";
             echo "<td width='110'  height='29'><b>Status :</b></td>";
             echo "<td width='117' bgcolor='#dce4ff'>". $row1['Status'] ."</td>";
             echo "<td width='117'  height='29'><b>Recieve Date :</b></td>";
             echo "<td width='117' bgcolor='#dce4ff'>". $row1['recieve_date'] ."</td>";
             echo "</tr>";
             echo "<tr>";
             echo "<td width='117'  height='29'><b>Forward Towards :</b></td>";
             echo "<td width='70' bgcolor='#dce4ff'>" . $row1['Forward_To'] ."</td>";            
             echo "<td width='117'  height='29'><b>Courier Type :</b></td>";
             echo "<td bgcolor='#dce4ff'>". $row1['Courier_Type'] ."</td>";
             echo "</tr>";
             echo "<tr>";            
             echo "<td width='117'  height='29'><b>Remark :</b></td>";
             echo "<td colspan='0' height='30' bgcolor='#dce4ff'>". $row1['remark'] ."</td>";
             echo "<td width='117'  height='29'></td>";
             echo "<td colspan='0' height='30' bgcolor='#dce4ff'></td>";
             echo "</tr>";
             
             ?>
             <?php 
             echo "</td >" ;
             echo "</tr>";
             }
             
             
             echo "</table>";?>
             <?php mysql_close($con);
          }
             ?>
    
             
        </td>
    
    <?php include("footer.php"); ?> ///////// the whole file is my courier_list.php

     

    add some debugging to your script to see what is happening:

     

    $sql = "SELECT A.courier_id, A.courier_no , A.sender_name ,A.saddress,
    B.location_name AS Sender_location  ,
    A.reciever_name ,A.raddress ,
    C.location_name  AS Reciever_location
    FROM  courier_detail A,location   B,location  C
    WHERE A.location2 = B.location_id AND
    A.location_id = C.location_id AND A.isdelete=0 ".$where; 
    $result = mysql_query($sql) or die($sql . '<br />' . mysql_error());

     

    1. the parenthesis should be removed from the actual SQL.

     

    2. run that snippet and post the results.

  2. Please could you give me an example of this, as I thought $uploadedfile was doing this.

     

    Sorry to be a pain!

     

    Thank you!!!

     

    there are examples on the page that you were linked to.

    In the given script, you are simply setting $uploadedfile to name of the file in the tmp directory.

    This has nothing to do with actually uploading the file to your server.

  3. ok, never @suppress your database actions.  Is there actualy a file being uploaded here? I see no check for if file exists...

     

    never use the @ error suppressing operator ever really.

    IMO, it's simply a band-aid for improper error handling.

  4. The user above me is correct, this can be done by either storing the dynamic parts of the query in a session, or by adding them to the query-string.

    So you would have something that looks like:

     

    http://site.com/some_folder/file.php?like=protein&start=25&limit=25

     

    the above would be the link to the second page, which you can use to re-build the query.

     

    Note: the best way would be to use a prepared statement, but that is a different story.

  5. Arrays need to be declared before you can push values onto them.

    You define the first array $itemcode_array = array(); but not the other two.

     

    I cant believe I missed that, thank you and sorry for wasting your time.

    Not a problem, glad it's sorted.

  6. What are the specific requirements of the update?

    Perhaps something like this:

     

    UPDATE `records` SET `status` = 'a' WHERE `date` = '2011-12-02' AND `employe_id` IN ( ... )

     

    The IN clause would contain a comma delimited list of ids

  7. Change:

     

    echo "the ref number is $last";

     

    to

     

    echo "the ref number is ".$last;   

     

    this is not needed, variables are interpolated inside of double quotes, what the OP has is fine.

     

    I'd take out the ` and either remove them completely or change them to '

     

    why? back-ticks are perfectly valid and are typically encouraged to wrap identifiers.

     

    OP, debug the query a little to see what is going wrong:

     

    $sql = "SELECT * FROM news WHERE `ref` = '$last'";
    $query = mysql_query($sql);
    if(!$query)
    {
        echo $sql . "<br />" . mysql_error();
    }

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.