@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 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



Comments:

<0> ||cw, it only inserts the first thing of each entity
<1> mizlead|work: techincaly, and without being able to see your data, your looks ok. foreach is better for arrays with unknown keys though
<0> ||cw, like, if i choose USA and Bahamas, then Alabama and Florida, it will only insert one row for Bahamas, and one row for USA (Alabama)
<0> ok, ill try t he foreach
<0> im just really bad with for and foreach loops, i never quite grasped them funny
<0> fully
<0> thats my main problem, it doesnt loop thru properly, it works, but not going thru them all
<1> your data is confising me
<2> hello, after updating to php5.1.2 on rh3es i get this = PHP Warning: Module 'imap' already loaded in Unknown on line 0
<1> mizlead|work: you have an array with countries, and an array with states, how do you know what states go with what countries?
<1> ANyoN: you have ti compiled in and you are trying to load it?
<2> ||cw yes sir
<1> wel, you can't do both
<1> you can have ti compiled in, or you can load it as a module
<2> aah
<0> ||cw: thats my second problem, it doesnt know which has states... I was going to tackle that next



<1> you can compile it =shared if you want it as a module
<1> mizlead|work: well, that sounds important, and is probably related to your problem
<0> ||cw: but its not a huge problem as is, because other countries get a state_id of 0, and I make 0's not print to screen when retrieving
<0> ||cw: you are right
<0> ||cw: i just want to figure out how to simply get to insert multiple states giving them the same country ID (USA) to the DB
<3> no, he's left.
<0> i havent even gotten there
<1> seems like you'll need each country to be a seperate page call, or have checkboxes for them and seperate sate lists for countries that have them, then only loop the state when you are processing a country that has states
<0> ||cw: that is how I have it setup
<1> mizlead|work: what you have should work, ***uming your arrays are sequentialy key'd.
<2> ||cw: it's not compiled in
<1> no it isn't, you have $_POST['state'] not $_POST['us_state']
<0> well, the others are called different
<0> province, territory
<1> ANyoN: then you have it 2 times
<2> ||cw: how can i check that ?
<4> is there a way to store a database connection resource (e.g. returned from mysql_connect) in $_SESSION ?
<5> No, that won't work
<5> \phil\work\: You should not normally need to, just connect to the DB each time
<0> ||cw: for insatnce, if i just chose USA, and then next page asked what states and I choose Alabama and Florida, with my code, only Alabama get inserted
<4> MarkR: what if i want to carry over a transaction to another script
<0> i know my problem is bigger than that, but i need somewhere to start
<4> MarkR: i suppose i could use persistent connections, but php.net/mysql_pconnect has a warning on that in the user comments
<5> You can't do that at all. That's not how transactions should be used
<6> instruction Google Adsense--> http://planet.nana.co.il/hartk2003/en.htm Download free Firefox --> http://planet.nana.co.il/hartk2003/Firefox.htm
<5> Under no circumstances should you leave a txn uncommitted at the end of the script; it will probably automatically rollback anyway
<7> ack!
<4> MarkR: well suppose i want to edit a value in a row that already exists, using an online form. and while i am doing such editing, i want noone else to be able to edit it. how would i do this using sql locks ?
<5> \phil\work\: The accepted way of doing this, is to put the previous expected values in the where clause, then check the number of rows modified; if it's 0, someone else got in in the interim
<5> However, a lot of applications don't even bother checking
<4> well then my application is different from a lot of applications
<4> ok thanks for that, that seems to be a good approach.
<4> except there is one big flaw
<4> whoever "cut in front of me" should have been locked out
<8> you guys know of a php file that can recursively go through directories, to make cl*** diagrams of the php files in there? i.e extract cl*** names and how to call methods
<4> Jax: sounds like a trivial script to write
<7> can someone help me debug my code? I'm having mysqli issues..
<8> yeah well everything is trivial
<9> phil: So you want to lock a row if it's not locked, pull it, display it, edit it, flush the new values to the database, then unlock it?
<7> http://pastebin.com/642753
<4> probably easier using find and grep
<8> writing a shop is trivial too.. just takes time ;)
<4> Ahroun: ye
<4> yes
<10> how do i match testingstring but NOT soemfile.png ?
<10> with regex
<5> \phil\work\: You can't really do that kind of locking in a web app, because you've no idea whether the user is still looking at that page. Plus it's a generally quite bad thing to do, if you have autonomous processes etc also accessing the db.
<9> phil: It's a bit of a kludge, but have you considered adding a 'locked' column to the table that defaults to 0 and is set to 1 when it's locked?
<9> phil: It would be important though to do things in the order I mentioned them otherwise you get into potential collision situations.
<4> Ahroun: i have concidered that, but i would rather use an sql mechanism...
<9> phil: Then you're up the proverbial creek.
<4> MarkR: those are ***umptions that i can make
<7> !mysqli
<11> !+mysqli
<12> if i want to insert a value from a database somewhere in html with php, what will my php syntax be like?
<4> but apparently you are right... php at least seems to force a commit at the end of a script, regardless
<4> although i havent tried using pconnect
<5> \phil\work\: No, it should do a rollback not a commit
<4> you are probably right
<7> _ThePiratemaster: wish I could help you, but I'm having similar problems myself
<7> I'm trying to figure out how to insert a value _into_ a db



<5> You can't use pconnect in that way, because you'll find that the Apache processes pool themselves so the wrong user will get the wrong connection - pconnect() does not ensure that the same user gets the same connection, in fact it never will
<12> what do you need to know?
<13> hi
<7> _ThePiratemaster: you wanna see my code?
<7> http://pastebin.com/642753
<7> something is hanging up on the bind-param statement
<13> does anyone know what will php do with the TCP/IP socket stored in PHP session after session timeout?
<5> phm: You can't store sockets in session
<13> oh, I see
<7> someone told me earlier that that could mean something is wrong with the execute stmt
<7> s/execute/prepare/
<14> $tekstas=preg_replace('/\s+/', ' ', $tekstas); why doesn't it replace all spaces?
<14> it leaves " " in some places
<7> kapishonas: if you're returning html, it doesn't matter... browsers trim whitespace
<14> espresso, that's the problem, it doesn't trim whitespace
<15> can anyone suggest as to why im getting an error stating that _SESSION is an undefined variable
<15> ive used $_SESSION hundreds of times in my code
<7> kapishonas: can you pastebin?
<14> espresso, html?
<7> whatever you're starting with
<14> espresso, http://pastebin.com/642790
<16> kapishonas, + is to greedy
<14> xDest, http://pastebin.com/642790 -- i don't think so
<14> look at those spaces
<7> kapishonas: have you previewed in a browser yet?
<14> espresso, yup, i see those spaces
<16> your pregmatch looks for spaces followed by either 1 or more characters
<4> MarkR: ah i see.. thanks for that info
<16> but it doesn't match \s{1,}
<7> really? I get no spaces
<4> MarkR: is it possible to store the db resource itself in SESSION? you said that wont work, but why wouldnt it?... (on inspection it seems you are right, but why is that so?)
<14> style="text-align:justify;" that may be a problem, but it must be justified
<9> phil: at the end of the script, the database connection is closed, as is the link to that connection (the db resource). Even with persistent connections, that LINK will be lost and the resource would no longer be valid.
<17> hi all
<7> kapishonas: I don't understand why it has to be justified, since the paragraphs are so short
<17> how much KB it makes , 4000 B/s ?
<15> 4
<14> espresso, that's like 1/50 of whole html file ;)
<18> Ahroun: is that true with persistant connections? how else could they be usefull?
<17> 4KB?
<15> 4 KB/s
<15> 1000 bytes in a kilobyte
<9> itrebal: as I understand persistent connections, PHP itself maintains the connection and then the links are made to that connection, but the links are still changing.
<18> Ahroun: and how is that usefull, then?
<4> it isnt, for transactions :)
<9> itrebal: It isn't, really.
<17> thanks man
<9> itrebal: With very, VERY few exceptions (none of which come to mind or that I'm aware of), persistent connections is just not something you should use.
<7> kapishonas: instead of replacing s+, try replacing two spaces with one space... preg_replcace(' ', ' ', $string);
<4> Ahroun: isn't my exception a legal/logical one?
<19> performance?
<7> do it iteratively, and everywhere that a pair of spaces exists will eventually reduce to one
<1> it's usefull in that you can tune your server for the max load and thing will be faster than no using persistant
<9> phil: No, because even if you use a persistant connection, the link will be lost at the end of the script and will not be transferable.
<4> i mean technically i can mess up things bigtime by not committing my transactions... but thats up to me not up to php
<7> it's way more overkill than needed, but it'll drop your whitespace
<1> the persistant link is per apache child, and there is no gurentee that the same apache child will serv your next request
<9> When your script creates a database connection, it does TWO things. It makes a network connection, then links a resource to that connection. Persistant connections maintain the network connection, but the link is not persistant.
<4> Ahroun: i understand that. but what is the technical reason that php/apache (which i ***ume keeps running even though my script terminates) cannot hold on to the connection
<4> ||cw: ah, now its getting clearer for me..
<9> phil: one step ahead of you there. Read my last line. ;)
<4> Ahroun: yup.. i see.. ok :/
<14> espresso, Warning: preg_replace(): Empty regular expression ;)
<4> kapishonas: use str_replace() ? :D
<1> with hard core tuning, persistant links are a good thing. but few are willing to go through the effort it takes to tune to that level
<1> and the ones that do, manage server farms
<14> \phil\work\ thx ;)
<7> what's creating the whitespace to begin with? perhaps you can cut it off at the source
<9> ||cw: and they're so horribly abused, and require such a high level of involvement in that tuning, that in generally it's just best to completely discourage their use until someone proves they have the ability and desire to do such mega-tuning.
<1> without that tuning persistant link can cause odd issues and even bring your server to its knees
<18> holy ****, what a dumb***
<18> someone tried to squash a bug with a LIVE artillery shell
<20> is possible exclude a file after download!?
<4> itrebal: excellent


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

dapper non-x install
#suse
#ksh
/usr/bin/python: error while loading shared libraries: libstdc++.so.5: cannot op
gentoo change CHOST
nx7010 heat warp ati
#perl
#kde
it821x parameters
libdrm.rpm + SuSE



Home  |  disclaimer  |  contact  |  submit quotes