Jump to content

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

                    }

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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