This topic is locked

Smarty>assign show value on menu template

9/8/2008 4:40:00 PM
PHPRunner General questions
F
fawad112 author

Hi all,
I need a little help with displaying the values of the table on the menu page. I am using the code below but i doesnot show anything .. I am using the Before Display. Am i missing something. I am also using {$ref} and {$deadline} in the menu.htm to display the values but it is working
[codebox]global $conn;
$str3 = "select writerid from accounts where username='".$_SESSION["UserID"]."'";

$rs3 = db_query($str3,$conn);

$data3 = db_fetch_array($rs3);

$writerid = $data3["writerid"];
//select all values from this view page

$str = "select * from accountdetails where writerid='$writerid'";

$rs = db_query($str,$conn);

while ($data = db_fetch_array($rs))

{

$ref=$data["ref"];

$deadline=$data["deadline"];

}
$smarty->assign('ref',$ref);

$smarty->assign('deadline', $deadline);
[/codebox]

J
Jane 9/9/2008

Your code looks correct.

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

F
fawad112 author 9/11/2008

Hi thanks Jane. It is working now but i am having problem in displaying all the row of the table. Please let me out with this. What i want to do is to display the rows below the menu page. Check the code below i must be missing something it is just displaying single row.

[codebox]$str = "select * from accountdetails where writerid='$writerid'";

$rs = db_query($str,$conn);
if (mysql_num_rows($rs) > 0)

{
while ($data = db_fetch_array($rs))
{
$smarty->assign('ref',$data["ref"]);

$smarty->assign('deadline', $data["deadline"]);

$smarty->assign('total',$data["writerstot"]);
}

}

[/codebox]

J
Jane 9/11/2008

Hi,
to display all returned values use following code:

$ref = "";

$deadline = "";

$total ="";

$str = "select * from accountdetails where writerid='$writerid'";

$rs = db_query($str,$conn);

if (mysql_num_rows($rs) > 0)

{

while ($data = db_fetch_array($rs))

{

$ref.=$data["ref"]." ";

$deadline.=$data["deadline"]." ";

$total.=$data["writerstot"]." ";

}

$smarty->assign('ref',$ref);

$smarty->assign('deadline', $deadline);

$smarty->assign('total',$total);

}

F
fawad112 author 9/11/2008

Hey thanks jane. i am getting all rows now <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=32959&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> but there is 1 another problem.. On the display page it is showing all the information from the table in a single row <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=32959&image=2&table=forumreplies' class='bbc_emoticon' alt=':(' /> ... how can i display them in single rows
[codebox]Refernce Topic Deadline
2479581 2479587 2479591 0000-00-00 00:00:00 0000-00-00 00:00:00 2008-09-11 00:00:00 2160 150 310

2479581 2479587 2479591 0000-00-00 00:00:00 0000-00-00 00:00:00 2008-09-11 00:00:00 2160 150 310 [/codebox]
I want it to display like this ..
[codebox]Refernce Deadline Amount
2479581 2008-09-11 2160

2479587 2009-09-13 150

2479591 2009-09-17 310 [/codebox]

J
Jane 9/12/2008

Hi,
try to use this one:

...

while ($data = db_fetch_array($rs))

{

$ref.=$data["ref"]."
";

$deadline.=$data["deadline"]."
";

$total.=$data["writerstot"]."
";

}

...

F
fawad112 author 9/12/2008