...

View Full Version : Need help, data cannot display



nurvirus
07-10-2007, 07:40 AM
http://i12.photobucket.com/albums/a208/n_amalyna/memo_content.jpg

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



<?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.

http://i12.photobucket.com/albums/a208/n_amalyna/memo_reply.jpg



<?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;
?>

PappaJohn
07-10-2007, 07:50 AM
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.

nurvirus
07-10-2007, 08:01 AM
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.

PappaJohn
07-10-2007, 08:04 AM
Just append it to the url:


second_page.php?id=1

using the name of your php file and a proper id, of course.

nurvirus
07-10-2007, 08:09 AM
Sounds stupid, but i really dont know so i have to ask.. hehe.. where to put the code? :p

PappaJohn
07-10-2007, 08:11 AM
That depends, how are you calling the second page (from a link, a form action)?

nurvirus
07-10-2007, 08:12 AM
ohh by click on a button reply.

PappaJohn
07-10-2007, 08:14 AM
please post the code where you are calling the page

nurvirus
07-10-2007, 08:24 AM
http://i12.photobucket.com/albums/a208/n_amalyna/memo_content.jpg

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
//$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

$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?

PappaJohn
07-10-2007, 03:33 PM
No. I see no reference to the second php file.

nurvirus
07-11-2007, 02:18 AM
<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
action="memo_reply.php?id=<? echo $rows[3];?>" the page could not find the id. I put the rows[3] because my query is
$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.

PappaJohn
07-11-2007, 03:17 AM
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:


action="memo_reply.php?id=<?php echo $rows[3];?>"

nurvirus
07-11-2007, 07:43 AM
hmm.. i just cant pass the id :( ive tried so many ways.

PappaJohn
07-11-2007, 07:52 AM
For anything more specific you're going to have to post the code (the whole file), otherwise guessing is pointless.

nurvirus
07-11-2007, 09:15 AM
okie .. i've upload all the files..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum