Jump to content

Seperating MySQL Data


cheechm

Recommended Posts

Hi,

Me again.

 

I do this:

 

                            while ($rowi = db_fetch_array($resulti)) {

                                echo $rowi['name'] .", ";
                            }

The comma shows on the last result as well. How can I stop that?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/119566-seperating-mysql-data/
Share on other sites

Doesn't seem to work either. I will post a bigger code block:

 

                    $sqlc = "SELECT name FROM customers WHERE cid = " . $cid . "";
                    $resultc = db_query($sqlc) or die("MySQL ERROR: " . mysql_error());
                    while ($rowc = db_fetch_array($resultc)) {
                        if ($row['delivery']) {
                            $delivery = "<li>Delivery: Required</li>";
                        }

                        echo "<ul class=\"qrequestsf\">";
                        echo "<li>Quote ID: " . $qid . "</li><li>Customer: " . $rowc['name'] .
                            "</li><li>Notes: " . $row['notes'] . "</li><li>Last Action Taken: " . date('d/m/Y',
                            strtotime($row['date'])) . "</li><li>Date required: " . date('d/m/Y', strtotime
                            ($row['pdate'])) . "</li><li>Return Date: " . date('d/m/Y', strtotime($row['rdate'])) .
                            "</li>" . $delivery . "<li>Kit Required: ";

                        $item = split(', ', $row['items']);
                        $items = array_unique($item);
                        foreach ($items as $value) {
                            $sqli = "SELECT name FROM hire WHERE id = " . $value . "";
                            $resulti = db_query($sqli) or die("MySQL ERROR: " . mysql_error());
                            $names = array();
                            while ($rowi = db_fetch_array($resulti)) {

                               echo $rowi['name'] .", ";
                            }

                        }
                        echo "</li><li>Status: " . $status_is . "</ul>";

                    }

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.