This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

ot: arrayproblem?

Old posts that have not been replied to for several years.
Locked
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

ot: arrayproblem?

Post by nso »

i know this is an 3rd-party program, and thus not exactly ontopic for egghelp. But since there may be some people here whom have experienced the same I thought I'd have a go at it.


I get a problem when I am collection more then one column from a row in my mysql-db using fbsql

When I am fetching a single column it is similar to this:

Code: Select all

        set row [sql "SELECT id FROM list_setitem WHERE id='$text'"]
        if { $row == ""} {
                putdcc $brukerid "No matches to your query - $text -. Please redefine your searchstring."
                sql disconnect
                return 0
        } else {
                putdcc $brukerid "\002You are now offering $row\002\nRemember to update your webpage! (.update)"
                sql disconnect
                return 0
        }
the output is

Code: Select all

<nso> .+offer 41
<d2> You are now offering 41
<d2> Remember to update your webpage! (.update)

this is all fine and dandy.
but if I want to select more columns, this is the result:
(selecting 'id,name' in the sql instead of just 'id')

Code: Select all

<nso> .+offer 123
<d2> You are now offering {123 {Trang-Oul's Guise}}
<d2> Remember to update your webpage! (.update)

So basicly there is generated unwanted {} around the individual columns.
When utilizing the full script I'm off course going to use lindex to split the variable up, but that is made very difficult by these {}.
I could off course use regsub, but that is a dirty solution, and I would really like to have a better way of doing it.

Any feedback would be appreciated.


Cheers, nso



edit: just realized that I had pasted the wrong bit of code. sorry. corrected now
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

Post by nso »

oh the wonderfull magic that 'join' can perform.
thanks to a kind soul on irc for this little tidbit of information
Locked