This topic is locked

Materials List

11/30/2009 7:16:52 AM
PHPRunner General questions
S
swanside author

Hello.

Last year you helped me with some code to pull a list of materials from another table. It works great, but it lists the materials as follows.
Item 1

Item 2

Item 3 and so on.
Is there anything I can do to change it to list them

Item 1, Item 2, Item 3, and so on?
Here is the code you did for me.

global $conn;

$sql = "select Title from quotationm where Quotation_No='".postvalue("editid1")."'";

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

$data = db_fetch_array($rs);

if(!$data)

return;

echo "<table>";

while(1)

{

echo "<tr>";

foreach($data as $v)

{

echo "<td>";

echo htmlspecialchars($v);

echo "</td>";

}

echo "</tr>";

if(!($data = db_fetch_array($rs)))

break;

}

echo "</table>";



Thanks

Paul

J
Jane 11/30/2009

Paul,
please check my changes below:

global $conn;

$sql = "select Title from quotationm where Quotation_No='".postvalue("editid1")."'";

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

$data = db_fetch_array($rs);

if(!$data)

return;

echo "<table>";

echo "<tr>";

while(1)

{

foreach($data as $v)

{

echo "<td>";

echo htmlspecialchars($v);

echo "</td>";

}

if(!($data = db_fetch_array($rs)))

break;

}

echo "</tr>";

echo "</table>";