| |
| |
| |
|
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 30 31 32
Comments:
<0> if( isset() || isset() .... <1> if (isset()) <2> pfft <2> I was hoping for something more elegant <3> my current project has MANY mysql queries on each page and i'm worried about the overhead of using mysql_connect() in each function that queries the database <1> zahazh <4> but to reasoning print_r is better than var_dump because it can store to string the result, its rather stupid.. since there is no need for that <1> enygma use flags :)) <3> what would be the best method of opening that mysql connection once per page load <3> ? <1> if (!mysql_connect() ) mysql_connect i think or something like that <0> uh, connect elsewhere & store the connection <0> Ciantic - uh no, for example you can feed it to mail() <0> etc. <4> :D there shouldn't be any case when you accidently open two connections <1> lol
<1> sjrussel : i still prefer use ob_start and var_dump <4> if so, the code must be rethought <4> i use ob_start too, a lot <5> fastly: mysql_pconnect() <0> that sounds like really ugly code <1> OHHHHH no <4> sjrussel, not really, templates are 'in' <1> pconnect ..... sometimes not (very not) the best way <6> no no no no... mysql_pconnect is not generally recommended unless you REALLY REALLY know what you're doing. <4> and obiviously, you don't <1> sure ? <0> look, just write or use an db wrapper <3> bit worried about this: "Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect())." <5> Well, okay. i've been doins this for ~6 years, that is what i use. :) <1> fastly use close function on every end script <4> well, mysql_connect keeps the connection, it doesn't really close it so it's safe to use it as getting high performance no need for pconnect <0> kennebel - there's a reason there's no mysqli_pconnect, and it's not because they forgot :) <6> kennebel: Then you probably have a clue of when to use it and when not to use it. Most newbies and beginners abuse the heck out of it and thus it's best to just not recommend it. <3> Ciantic, so you mean if the same connection details are used then a new connection is not opened? <7> I have a 2 dimensional array like: $array = array(0 => array('product'=> $x), 1 => array('product' => $y)); whats the easiest way to search $array for a specific value with the 'product' key? <1> if you want to use pconnect, first manage you persistent OUTSIDE <4> fastly, yes, mysql_connect can handle that <3> nice, i'll cease worrying then ;-) <4> it actually doesn't open new connection on every page load <3> thanks guys <3> only when mysql_close()? <4> on the end of file <4> end of all page stuff <3> and after some period of inactivity.. ok <0> Ciantic - I think it does <1> php.net/manual/fr/ref.array.php <0> it only doesn't open a new db connection if the most recent connection is the same <8> will ask again. Can anyone tell me what the cleanest way to split code onto multiple lines <4> i have files called raw_top and raw_botom that is loaded on every page load, to handle these every page beginning and end scripts <0> cmwneo: newlines <4> :D <9> InterLNK: try array_search() <8> well i have a huge ldap search call. Is there no way to indent it on a new line instead of wraping it? <8> like \ or something ? <9> cmwneo just make a new line? <9> or what do you mean <7> i believe array_search only lets me search for a value? I need to match the key and the value.. <8> sql_connect ($config['sql']['host'], $config['sql']['user'], $config['sql']['p***'], $config['sql']['db']); <8> that wraps.. is there no way to break it up into multiple lines? <9> InterLNK: then you need maybe to write a custom search function and use array_wal_recursive for example <0> hit [enter] <0> where you want it to break <9> :D <8> then ident it? <8> doesnt seem very clean <9> however you like <0> if you like <0> wtf? <10> cmwneo: the php parser ignores whitespace <7> ah ok, i was hopin there was a builtin for it that i was missing <0> are you using and IDE? <8> arr thanks ||cw <8> sjrussel no vi <9> InterLNK: probably there is a better method... <1> do someone here use php_beautifier or a nice beautifier ?
<9> InterLNK: maybe in_array() is sufficent? <7> i think i'll have to use array_filter <0> if not, switch to emacs and learn lisp, write your own. should occupy you for a bit, until you realize it doesn't matter <1> sjrussel for me ? <11> Is there a way to configure fopen so it will only open approved URLs ? <0> nope, cmwneo <1> ok :) <11> I have a bunch of stuff that uses that but I don't want to turn it on globally <0> xbeanx - write a wrapper, use that <0> instead <12> php is not working with apache <1> so no source code beautifier here ? <12> it just sends the whole file verbatim to my browser <11> sjrussel: is there a way to write a wrapper that will work site wide? Sorry, I haven't done one before. <9> iammisc: addType <1> iammisc look at #apache or the httpd.cond <11> sjrussel: I want to fix these scripts without having to change each one individually <0> oh <0> probably, no dices <12> addtype is already done <9> php module is loaded? <13> installation questions ... <13> so much can be wrong <12> woops, I see, The add type was for application/x-php instead of application/x-httpd-php <12> thanks <13> nice <14> hi <1> bye all <15> How can I echo to the screen if I have a successful connection? $conn = mysql_connect($dbhost, $dbuser, $dbp***) or die ('Error connecting to mysql'); <16> echo "Connection successful"; <15> oh, because otherwise I will get die right? <16> Since the script would terminate if the connection failed <15> and it would give the die message right? <16> Yes <15> sweet, you da bomb <10> or die(mysql_error()) <10> you'll probably want to knwo why it failed <17> hi, is there a php function that converts a german date dd.mm.yyyy to a american or postgresql one like yyyy-mm-dd ? <11> Is it possible to turn on allow_url_fopen for a single directory in a .htaccess file? I'm trying but it doesn't seem to be working. <16> hyksos_- sure, substr, or explode <16> xbeanx- think so, but let me check <16> Then again, apparently not <16> allow_url_fopen "1" PHP_INI_SYSTEM <11> Dragnslcr: but I don't want it enabled site wide <11> Only for a single directory which contains a known-secure script <18> hi all, I am looking for some way to keep html and php pages seperate <18> but I don't like smarty, so I prefer not to use it. <6> So you're actually looking for a templating system. <18> hmm not really <18> just a way to keep html and php seperated <18> I tried smarty, but did not like it at all, too big for what I need to do <6> ooookay... that's generally what a templating system does. How else were you wanting to separate HTML and PHP? <4> smarty is stupid, there is no way i'd create own syntax above good syntax already <18> hey, that was my question =) <4> Ahroun, easily, with very simple template cl*** <6> that'd still be a templating 'system'. <19> I don't see how Smarty is too big <6> It'd just be potentially easier than Smarty. <19> I rather like it. And it is very nice at keeping HTML and PHP separate. <18> or another question, how can I output while loops to smarty as I tried that but it isn't really working <19> use sections <4> Ahroun, which construtctor takes in filename, runs that and you can do like $temp = new Template("file.php"); $temp->Title = "title" ... and in file.php you have <html>..<title><?=$this->Title?></title... very simple working fast.. everything! <20> Try #smarty <19> {section name=loop loop=$loop} <4> and when you want, run $temp->Render(); <17> i use 2006-03-12 as date in a INSERT statement, but it returns, that it is an integer not a date? how should i insert date? <11> Do I have to do anything special in php.ini or anything to use .htaccess files? It seems like nothing I put in the .htaccess file works. I have the AllowOverride All option set for that directory. <19> oh, I misread your question <4> that is like the most idiotic idea i've heard to create own syntax <18> problem is I do know some stuff about OOP, but am no OOP guru and my code isn't written OOP but procedureal <6> olger901: Heeeeey, a fellow proceeduralist. Awesome. <4> procedural <13> xbeanx: no, nothing special in php.ini, see also http://php.net/configuration.changes <18> Ahroun: any suggestions?
Return to
#php or Go to some related
logs:
gentoo chrot howto #css a8e abbreviate perl alarm timeout socket win32
slackware acpi_fakekey udev driver option #linux #web #centos #math
|
|