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 15 of 15
  1. #1
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help, data cannot display



    this is the table of memo content.. it display the data. this table works well.. and this is the coding for memo_content..

    PHP Code:
    <?php
    $id 
    $_GET['id'];
                     
    $query="SELECT DISTINCT memo_title, memo_date, memo_message, memo_code,memo_sender FROM memo where memo_code=$id";
                     
    $result=mysql_query($query) or die ('Error in query: $query. ' mysql_error());
                     
    $rows=mysql_fetch_array($result);
                    {
                    
                    
    ?>

    <tr> 
                <td width="16%"><div align="right"><strong>Date</strong></div></td>
                <td width="84%"><?php echo $rows[1]; ?> <input name="memo_date" type="hidden" id="memo_date" value="<?php echo $rows[1]; ?>">
                &nbsp;</td>
              </tr>
              <tr> 
                <td><div align="right"><strong>Title</strong></div></td>
                <td><?php echo $rows[0]; ?> <input name="memo_title" type="hidden" id="memo_title" value="<?php echo $rows[0]; ?>"></td>
              </tr>
              <tr> 
                <td><div align="right"><strong>Message</strong></div></td>
                <td><textarea name="textarea" readonly="true" cols="50" rows="14"><?php echo $rows[2]; ?></textarea>
                  <input name="message" type="hidden" id="message" value="<?php echo $rows[2]; ?>"></td>
              </tr>
              <?php
                      
    }
                    
    mysql_close;
              
    ?>
              <tr> 
                <td colspan="2"><input name="Button" style="font-size: 12px;" type="submit" value="Reply"> </a>
                  <input name="Button" type="button" onClick="Cancel()" style="font-size: 12px;" value="Cancel"></td>
              </tr>
    and this is the not working tablee.. the data did not displayed. the error said the query is wrong.. but then the query is the same page as the memo_content... Can someone help me. Thank you.



    PHP Code:
    <?php

                     $id 
    $_GET['id'];
      
    $query="SELECT DISTINCT memo_title, memo_date, memo_message, memo_sender, memo_code FROM memo where memo_date='$memo_date' and memo_code='$id'"//where memo_code=$id";
                     
    $result=mysql_query($query) or die ('Error in query: $query. ' mysql_error());
                     
    $rows=mysql_fetch_array($result);
                    {
                    
    ?>
    <tr>
                <td width="22%"><div align="right"><strong>Date</strong></div></td>
                <td width="78%">
                <script language="JavaScript">
                <!--
                sampleDate1=new Date()
                document.write (""+ mdy(sampleDate1))
                //-->
                </script>
                <input name="memo_date" type="hidden" readonly="true" id="memo_date" value="<?php //echo $rows[1]; ?>"></td>
              </tr>

               <tr>
                <td><div align="right"><strong>Title</strong></div></td>
                <td><?php echo $rows[0]; ?> <input name="memo_title" readonly="true" type="hidden" id="memo_title" value="<?php echo $rows[0]; ?>"></td>
              </tr>


              <tr>
                <td><div align="right"><strong>Message </strong></div></td>
                <td><textarea name="memo_message" readonly="true" id="memo_message" cols="50" rows="5"><?php //echo $rows[2]; ?></textarea>
                  <input name="memo_message" type="hidden" id="memo_message" value="<?php echo $rows[2]; ?>"></td>
                     </tr>
                     
                     <tr>
                     <td><div align="right"><strong>Message Reply </strong></div></td>
                   <td><textarea name="memo_message" id="memo_message" cols="50" rows="5"><?php //echo $rows[2]; ?></textarea>
                  <input name="memo_message" type="hidden" id="memo_message" value="<?php echo $rows[2]; ?>"></td>
                     </tr>

                <?php
                      
    }
                    
    mysql_close;
              
    ?>

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Difficult to say for sure without seeing the actual error message you are getting. It would be helpful to post that.

    Off the top of my head, I'm thinking that maybe 'id' isn't being passed to the second page.

  • #3
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it didnt appear error message but the data did not appeared. i thought so.. the id didnt passed to the next page.. anyone know how to pass it? Really appreciate your help.

  • #4
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Just append it to the url:
    Code:
    second_page.php?id=1
    using the name of your php file and a proper id, of course.

  • #5
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sounds stupid, but i really dont know so i have to ask.. hehe.. where to put the code?

  • #6
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    That depends, how are you calling the second page (from a link, a form action)?

  • #7
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ohh by click on a button reply.

  • #8
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    please post the code where you are calling the page

  • #9
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts


    above is the page where i have to click on reply button before go to the next page.

    and this is the above query code

    PHP Code:
      <?php
                     
    //$id = $_Request['memo_code'];
                    //$query="SELECT memo_title, memo_date, memo_message, memo_code FROM memo where id='%memo_code'";
                     
    $id $_GET['id'];
                     
    $query="SELECT DISTINCT memo_title, memo_date, memo_message, memo_code,memo_sender FROM memo where memo_code=$id";
                     
    $result=mysql_query($query) or die ('Error in query: $query. ' mysql_error());
                     
    $rows=mysql_fetch_array($result);
                    {
                    
                    
    ?>

    <tr> 
                <td colspan="2"><input name="Button" style="font-size: 12px;" type="submit" value="Reply"> </a>
                  <input name="Button" type="button" onClick="Cancel()" style="font-size: 12px;" value="Cancel"></td>
              </tr>

    Below is the query code for the page that i want to pass the id


    PHP Code:
     <?php

                     $id 
    $_GET['id'];

                     
    $query="SELECT DISTINCT memo_title, memo_date, memo_message, memo_sender, memo_code FROM memo where memo_date='$memo_date' and memo_code='$id'"//where memo_code=$id";
                     
    $result=mysql_query($query) or die ('Error in query: $query. ' mysql_error());
                     
    $rows=mysql_fetch_array($result);
                    {
                    
    ?>
    is that what you need?

  • #10
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    No. I see no reference to the second php file.

  • #11
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
     <form name="form1" id="form1" method="post" action="memo_reply.php?id=5"
    can i pass the id like this? through a form at the action? but of course the id is not equal to 5 if not it will only show details on id no 5.

    i've tried this method but then when i put
    PHP Code:
     action="memo_reply.php?id=<? echo $rows[3];?>"
    the page could not find the id. I put the rows[3] because my query is
    PHP Code:
      $query="SELECT DISTINCT memo_title, memo_date, memo_message, memo_code,memo_sender FROM memo where memo_code='$id'"
    am i on the right track? Thank you.

  • #12
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Well you're on the right track, but I'm not sure why you are using $rows[3]. How are you returning rows from that query?

    Also, if your server configuration does not allow short tags, then you'll need to use:
    PHP Code:
    action="memo_reply.php?id=<?php echo $rows[3];?>"

  • #13
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hmm.. i just cant pass the id ive tried so many ways.

  • #14
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    For anything more specific you're going to have to post the code (the whole file), otherwise guessing is pointless.

  • #15
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    okie .. i've upload all the files..
    Attached Files Attached Files


  •  

    Posting Permissions

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