I'm not quite sure which function to use when I want to add a comma to
the end of every line and a semi colon to the last one. Because it
generates everything on the fly I can't count the rows from a db.
Here's what I want to do:
red, <--Comma
green, <--Comma
blue, <--Comma
orange; <--Last one so semi colon
Any help is greatly appreciated 3 3172
BryanA wrote:
I'm not quite sure which function to use when I want to add a comma to
the end of every line and a semi colon to the last one. Because it
generates everything on the fly I can't count the rows from a db.
Here's what I want to do:
red, <--Comma
green, <--Comma
blue, <--Comma
orange; <--Last one so semi colon
Any help is greatly appreciated
How do you know when you reach the last one?
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
BryanA wrote:
I'm not quite sure which function to use when I want to add a comma to
the end of every line and a semi colon to the last one. Because it
generates everything on the fly I can't count the rows from a db.
Here's what I want to do:
red, <--Comma
green, <--Comma
blue, <--Comma
orange; <--Last one so semi colon
Any help is greatly appreciated
Why can't you count the rows? I need a little more info, but assuming
you have all the lines in an array; from the example given for implode()
in the manual:
$array = array('lastname ', 'email', 'phone');
$comma_separate d = implode(",", $array);
then simply:
$comma_separate d .=";"
BryanA wrote:
I'm not quite sure which function to use when I want to add a comma to
the end of every line and a semi colon to the last one. Because it
generates everything on the fly I can't count the rows from a db.
Here's what I want to do:
red, <--Comma
green, <--Comma
blue, <--Comma
orange; <--Last one so semi colon
Any help is greatly appreciated
How about adding a comma at the end of every row and then after it is
all done do a string replace for the last character? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andreas Paasch |
last post by:
I'm having trouble with the implode function and need some help here.
I've been reading at php.net but that didn't solve my problem.
I'm having the below code:
$query = "SELECT top1, top2, top3, top4, top5, top6,
top7, top8, top9, pricesmall, pricelarge
FROM esperia
WHERE productnumber = '$bestil'";
|
by: Shawn Campbell |
last post by:
Here's my scenario:
I'm creating a build environment with one system acting as the main
build dispatcher and other systems as the build hosts. On the main
build system I have Apache, MySQL and PHP installed and I'm building a
website that will allow people to view/start/etc. builds.
I'm trying to get PHP to implode a log file that resides on one of the
host builds systems. I have the host and and the share, so what I'm
passing into...
|
by: Rob |
last post by:
hi,
using PHP 4.3.3 and Apache (ADVX) 2.0.47 and i want to get the contents of
my SETI stats site :
$personal = implode("",
@file("http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?email=$email&cmd=user_stats_new"));
which gives me this :
|
by: Jeff |
last post by:
Hello.
Quick background as I dont wish to hog anyones time. I am a customer of a
PHP/SQL programmer. A website that I had the programmer build for me is
working great, with one exception.
I have limited programming experience, most of it Pascal/C++ and I haven't
programmed for many years now even then it was mediocre programming of small
this and thats.
|
by: Geoff Berrow |
last post by:
I don't particularly need to do this but I've just found out that
print implode("<br>", $_SERVER);
Gives the warning :
Notice: Array to string conversion in c:\phpdev\www...
Doesn't do it with any other array and of course
foreach($_SERVER as $value){
| |
by: DJ Craig |
last post by:
I have 2-dimensional array with numeric indices for both dimensions,
called $results, which contains the search results from a database.
The first dimension contains the records, and the second contains the
fields. I want to convert it into an XHTML table to echo to the
browser. For a 1-dimensional array, I would do this with implode().
Can I use implode() on a 2D array? If not, is there some other
function I could use to do this, or...
|
by: Stephen Kay |
last post by:
Maybe I don't understand how to use this yet, but I was using (example):
$html = implode('', file('http://www.mysite.com/transbar.html'));
echo $html;
This works.
But if I try it on a .php file:
|
by: NoWhereMan |
last post by:
Maybe a stupid question.
-------------------------
1
-------------------------
$str = '';
for($i=0; $i<10; $i++)
$str .= $i;
|
by: scatfly |
last post by:
I have a set of values that were put into a form and am now using this to put into a database. this is my error:
"Warning: implode() : Bad arguments. in /home/xxxxxx/public_html/login.php on line 177
Couldn't execute insert query."
$today = date("Y-m-d");
$fields_str = implode(",",$fields);
$values_str = implode('","',$values); <=line 177
$fields_str .=",createdate";
|
by: tokcy |
last post by:
Hi,
I am having a problem with implode() function in PHP.
whenever i am running my code it display an error like.
Warning: implode() : Bad arguments. in D:\xampp\htdocs\admin\addspecs.php on line 8
and my code is
$as = $_POST;
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |