logs archiveIRC Archive / Freenode / #php / 2006 / March / 1 / 1
myc
i needed 0,1
php5
0,-1
^Artnez
oh, REMOVE .. :P me gets blind
nebmo: $orderby = $_POST['orderby'] ?
SunShineLady
nebmo - if ($_POST['sorderby'] == username) $order = 'ORDER BY username'; then $order goes to the mysql query
choongii
nebmo, you probably also would like to use <option value="blabla">Long long description of blabla</option>
^Artnez
nebmo: yea, you have no value set to it
nebmo: and dont what SunShineLady said, that's bloated code
nebmo
:S
SunShineLady
^Artnez - what do you suggest then?
choongii
I'd go with if(bla) { $query .= addslashes(" order by $bla"); }
SunShineLady
Chaosii - mysql injection!!!
         

choongii
hence the addslashes :)
zeasier
what does php do when it encounters a deadlock on a innodb mysql table?
choongii
or mysql_real_escape_string.. whatever floats your boat
Julian|Work
mysql_real_escape_string(), not addslashes()
SunShineLady
I would rather do a switch
^Artnez
nebmo: http://pastebin.com/577406
nebmo
i've pastebin'ed the page's code... --> http://pastebin.com/577405 <-- if that helps any (thanks_
^Artnez
regex may be off :P
nebmo
:) thanks... i'll try now quickly
choongii
aghhh it's a tenary operator !! help!!
zeasier
i've been trying to write a database driven session handler, but the trouble is i've been getting read/write clashes
choongii
it's burning my eyes! aaagghh!!
SunShineLady
^Artnez - thats a nice one
^Artnez
zeasier: you probably will.. there's no point in doing that anyway
madsara
What's the good regex to parse csv in php?
zeasier
^Artnez: we use db sessions for server mirroring
SunShineLady
^Artnez - You know the times when you write some script then you see a better way of doing it so you feel bad about your code? damn you!
madsara
I'm not having luck with: ,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))
(Shows as bad regex)
^Migs^
I wish there was a way to smack people with a sledgehammer over the Internet
et
madsara: http://de3.php.net/fgetcsv
         

^Migs^
I'm trying to help someone code a PHP page and he has NO FREAKIN CLUE HOW TO DEBUG
zeasier
^Migs^: yeah i don't why we fixed the ping of death
^Artnez
zeasier: the mirrors resolve to different domain names?
gimmulf_
Hi, could someone help me with the syntax here: $finished_hand = str_replace($b,'<strong>.'$b'.</strong>',$replace_hand);
^Artnez
zeasier: not to go into a completely different direction, but if you want session handling via DB you're going to get a performance hit no matter what you do
AfroTurf
gimmulf_ $finished_hand = str_replace($b,'<strong>'.$b.'</strong>',$replace_hand);
zeasier
^Artnez: it's multiple boxes all with the same vhost settings
gimmulf_
cant i mix ahh the dots, thanks!
^Artnez
zeasier: then there's no point .. (ie: us1.php.net, us2.php.net).. if thats the case, you do not need to store sessions in the db to maintain session data between page loads
AfroTurf
gimmulf_: or you could do $finished_hand = str_replace($b,"<strong>{$b}'</strong>",$replace_hand);
^Artnez
zeasier: sessions utilize cookies to store the session ID on the user's computer (they can pass the session ID in the URL too, but if you're security practices are descent, this wont be a problem)
AfroTurf
gimmulf_: or you could do $finished_hand = str_replace($b,"<strong>{$b}</strong>",$replace_hand); *
^Artnez
zeasier: cookies can be used across subdomains
AfroTurf
gimmulf_: ignore the first one
zeasier
^Artnez: perhaps mirroring is the wrong term, i mean load balencing
AfroTurf
load balancing
^Artnez
zeasier: in any case, if your users get swithced from eu.zeasier.com to us.zeasier.com, you shouldn't have a problem keeping the session data
zeasier
AfroTurf: gaim warned me too don't worry
^Artnez: that's nice, but from a purely retorical standpoint i'm still having trouble getting db transactions to lock my session properly
myc
it takes me .017 seconds to pull a users profile from the database
zeasier
i set autocommit to 0 and commit on my last query
myc
profile = session
zeasier: and you did a start of the transaction correct?
zeasier
myc yeah i did
myc
kk thats my 0.02
^Artnez
zeasier: what db?
zeasier
it's mysql and an innodb table
^Artnez
version?
and version of PHP
zeasier
php 5.0.something
and mysql 4ish
^Artnez
are you using MySQL or MySQLi
extension
zeasier
just mysql mysql_query() etc
and yeah only vallina mysqld
^Artnez
hm.. is mysql spitting back errors?
AfroTurf
zeasier: put <? phpinfo(); ?> in a page and give the info that ^Artnez needs
^Artnez
i might have missed it above
ShuaiKing
helo
zeasier
it it just overwrites sessions if two requests run at once
ShuaiKing
i have a <textbox> and I want to convert all the "enters" in there into <br /> s using PHP
Is possible?
^Artnez
zeasier: ah so the locks arent working
mattmcc
ShuaiKing: http://php.net/nl2br
zeasier
^Artnez: yup they aren't
ShuaiKing
sweet
thanks!
zeasier
^Artnez: what is supposed to happen when there is a deadlock? does php throw an error?
^Artnez: or does it just wait for the lock to go away?
ShuaiKing
Aah, I keep forgetting. when you use double-quotes with a $variable, does it say $variable or does it report the variable contents?
Toerkeium
hello guys, how can I set an array( "title" => "value") len ?
mattmcc
Eh?
^Artnez
zeasier: trying to remember... i was working with all of this stuff like 3 months ago
zeasier
ShuaiKing: double quotes mean php parses the string for variables
Toerkeium
hmm.. apologizes for my poor english
sorry, I am confused. I am working with mp3 files and its id3 tags. When I set the title for an id3 tag, it's ok, but when I read it, I read the title information, plus more characters till they get to the character len of 30
understand what I mean?
^Artnez
zeasier: you have the code onhand so i can see the queries?
mattmcc
^Artnez
zeasier: and PHP should wait a certain amount of time until the lock is lost
zeasier
^Artnez: ok that's good, i'll post the code one moment...
Toerkeium
thanks mattmcc, I am going to see it now
zeasier
http://pastebin.com/577449
we have a custom database object, it more or less does what it's supposed to
lig
Morning
mattmcc
What more could you ask from an object.
matthieu
hello
zeasier
db->autocommit(false) is SET AUTOCOMMIT = 0
and db->commit() is COMMIT
matthieu
this seems to work but is it ok to do this inside a class: $this = new MyClass($arg);
gimmulf_
How do i replace a blankspace with str_replace? how do i type the blankspace?
mattmcc
Press your spacebar?
gimmulf_
for example if i want to replace "----- WORD -----"
Toxygene
Anyone know if there's a compelling reason key() can only return strings?
gimmulf_
mattmcc: tried that :)
but it doesnt want to replace "----- WORD -----"
Fly_80
hi all
mattmcc
Toxygene: Hmm. $a = Array('foo'); var_dump(key($a)) -> int(0)
^Artnez
zeasier: where do you lock/unlock tables
Fly_80
is there a way to know the size or the name of the file before uploading it within a form ?
mattmcc
Fly_80: Nope.
Toxygene
mattmcc: Sorry, lemme be more specific, why can't Iternator::key() return objects... I want to implement a HashTable =(
zeasier
^Artnez: no where i'm using innodb transactions
mattmcc
Fly_80: Well, its name may be visible to JS.
^Artnez
zeasier: rows, rather
gary
I have an interview tomorrow for a junior php developer role :S
mattmcc
Toxygene: Array keys can only be scalars.
mfonda
Toxygene, think about what a key is
^ATOMIC^
how do i make php work on command line when i type php file.php it wont work
gimmulf_
mattmcc: if example: $string = "----- WORD -----"; $replace with = "something"; str_replace($string, $replace_with, $string); wont work
it doesnt replace it
zeasier
^Artnez: - i was under the impression you used SET AUTOCOMMIT = 0 and COMMIT to lock rows
Toerkeium
mattmcc, it worked excellent! thanks a lot
^Artnez
well yes, the lock starts while the transaction is open
zeasier
^Artnez: that happens on line 17 and 64
mattmcc
gimmulf_: Is the whitespace something other than a space? Like newlines, tabs, etc?
gimmulf_
mattmcc: hmm could be but looks like a whitespace
Toxygene
well, a HashTable would be a really nice library and to make it traversable, key() needs to return objects
gimmulf_
mattmcc: how do i make a tab?
^Artnez
well it seems right in structure ... only thought that comes to mind is if the SQL is off
mattmcc
"\t"
gimmulf_
press tab? :)
okok
^Artnez
*off the mark
mattmcc
gimmulf_: You may also simply find http://php.net/trim useful.
zeasier
hmm then i better log an paste it
^Artnez
zeasier: the idea is for the connection to wait until the lock has been let go
gimmulf_
$to_replaca = "----\tWORD\t-----"; hmm what would the syntax be? :)
or that will do it?
^Artnez
zeasier: sorry gotta run
Toxygene
I guess my real question is, structurally, is there any reason why Iterator::key() won't let you return a object?
zeasier
http://pastebin.com/577475
mattmcc
Toxygene: Because keys can't be objects?
zeasier
^Artnez - oh thanks anyway
mfonda
Toxygene, php has associative arrays, what would you gain from making a hash table? (and why, or even how, would you use objects as keys?)
Toxygene
two parallel arrays of keys and values in side a class that implements ArrayAccess and Iterator
er, just ArrayAccess
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 next »