| |
| |
| |
|
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 33 34
Comments:
<0> order* <1> genelisp: you'll also may want SUM(). see #sql, the /topic has some good tuts <2> Ciaran: thanks <2> ||cw: thanks <2> ||cw: so if I sort on supplier_id then group by supplier_id, I'll essentially get that array structure you proposed but in the form of an SQL result? <3> would this be the right way to look for a OR b OR c OR d in a string? preg_match("/(a|b|c|d)/", $string) <1> genelisp: not exactly. but with group by and SUM() you can get a complete ready order <2> ||cw: why do I need to use SUM()? <1> genelisp: to see how mnay items you need to order <4> Kaitlyn- if it's actually those characters, [a-d] would probably be better <4> Kaitlyn- if you're just asking about OR in general, then yeah, it's | <3> Dragnslcr: i just wanna make a check for a "demo mode" so that sql query cannot include DELETE, UPDATE, REPLACE>. <3> preg_match("/(DELETE|REPLACE|UPDATE)/", $query) is good? <2> ||cw: ok, thanks <5> Kaitlyn, err. use a differente mysql user with less priviledges <6> hello, does anyone know an interactive php shell for windows?
<6> "php -a" doesn't seem to do anything <3> colder: heh its a script that could be used anywhere.. i just want a switch for demo or not :) <5> Kaitlyn, that's pretty unsecure <7> nir_ai: make sure you start with <?php <3> colder: how so? <3> ***uming some end user with no access to the actual files for editing <3> how can they perform something? <5> Kaitlyn, what about SELECT 'malisiouc code' INTO OUTFILE ... <6> Ahroun, ok, now it works <3> colder: all the queries are already "known" they can't be generated dynamically <6> is there anything more similar to a Python shell? <3> and there is no INTO OUTFILE <3> besides, I am allowing select? <7> nir_ai: Dunno, never used Python. Just remember that php -a requires your input to look exactly like what you'd input as a file, including tags. <5> Kaitlyn, ok, then that's another story. <6> Ahroun, ok, thanks. <3> colder: heh :) ya... so is there anthing i am missing? insert, delete, update, replace... don't want them to be able to alter mysql data <6> Python is a great scripting language <6> I am new to PHP <5> Kaitlyn, but still, limitting stuff based on the query is IMO not the way to go <8> Heidi ho. Is there a way to get pretty output like from print_r or var_dump, except go to a string instead of stderr/stdout? <7> pistos: check out output buffering, ob_start() <6> does PHP only exists inside <?php/> tags? <7> nir_ai: Yes. <8> Ahroun: Is there no other way?? <5> nir_ai, there are multiple possibilities, though, and the tag is not <?php /> <6> what is the tag? <5> nir_ai, the preffered way is <?php /*code here */ ?> <8> I mean, I would have ***umed that print_r et. al are calling some subfunction which does the to-string conversion. <7> if you had: <?php echo "1"; ?> echo "2"; .... you'd see: 1echo"2"; <6> problem with "php -a" is that it quits on errors. Anyway to avoid that? <4> Pistos- var_export has a second argument to return the string instead of sending it directly to output <8> Dragnslcr: Thanks, that's exactly what I need, I'll check it out. <5> nir_ai, what do you want it to do on errors ? <8> Dragnslcr: Man, I was just looking at that page. :) I guess I have to read more carefully... <6> colder, give information on the error and remain in interactive mode, of course <7> pistos: function printr_to_string($myVar){ ob_start(); print_r($myVar); return ob_get_clean(); } <6> I don't want to loose all the context because of a typing error, or other errors <7> pistos: Just make sure you don't use that with output buffering already on. <8> Ahroun: Okay, thanks. I don't think we have it. <7> Pistos: have what? <8> Ahroun: ob on. <7> ah, 'k. <4> nir_ai- I don't think interactive mode is supposed to be used for anything more than quickly testing one or two lines of code <9> hay peeps just a quick question http://pastebin.com/637894 how do i echo the top 6 lines <6> sure, but when you quickly test something you can expect it no to work as expected, otherwise you would not need to test it in the firstplace, this is why it is convinient not to have the interpreter fly <1> Smokin: for i=1 to 6? <9> im using echo $rowty['num_votes']; <9> but thats dumping the how table <4> Smokin- why not limit the query to 6? <10> I have some problems understanding why my script using a simple $_SESSION value doesn't echo the value... can somebody help me to understand what's wrong? http://pastebin.com/637896 <1> Smokin: you could also just use LIMIT 6 in the sql <9> $sqlty="select username, count(*) as num_votes FROM votes group by username order by num_votes desc limit=6"; <9> like that? <4> firepol- probably because you don't have session_start() <4> LIMIT 6 <10> wasnt session_start deprecated? <4> Not unless I missed a major announcement <1> Smokin: did I say limit=6? no i didn't. you could try reading the mysql docs <7> firepol: session_start is not deprecated.
<10> Dragnslcr: thank you <9> $sqlty="select username, count(*) as num_votes FROM votes group by username order by num_votes desc limit 6"; <10> Ahroun, thanks <10> it works now$ <9> where would i put limit 6 ||cw <1> mysql.com/limit <11> hi all <11> nobody know <5> nir_ai, php will give you information on the error, if you configured it to do so. But there is no "interractive mode" <7> colder: php -a <12> hello <12> I am trying to parse some doata from a txt file <12> now one of the lines is like this: "Your new username: myusername" <9> ||cw read this page and still confused <12> How can I get "myusername" out of there wiout knowing the exact phrase in the folowing line? <12> strpos($file_content, "Your new username: ")... will give me the start of the string... <12> the end should be the first next \n or \r\n <12> how can I get that <12> ? <7> Lion: use regex instead then. <13> Lion28Wrk: given that, and the line length you shouldn't have a problem using substr() <13> you don't need a regex <4> Or use file() and find the line that starts with that string <4> Then you can just use substr($string, strpos(...)) <1> Smokin: then try #mysql, it's offtopic here <5> I'm wondering what the use of an interactive mode in php is ... <12> caffinated: I don't know the line lenght.... I am not parsing the file by lines... just fetching whole content <7> colder: Who knows? But it does exist. <4> colder- good for testing one-liners <13> Lion28Wrk: then you should be reading the file in line by line. <12> hmm <13> either that, or split it in to lines after the fact. see: http://php.net/explode <12> caffinated... this could be an idea <14> Reading line by line is more effective though :) <15> what could be a reason when the browser refresh (no matter if firefox on linux,windows or IE) does not refresh the page? I do have several pragmas there to prevent caching <13> [EaK]Konky: not a php issue. try #web or #html <14> Have you emptied the cache? <15> this is not a html issue <14> Firefox is a bitch when it comes to cache <15> i can see the browser sends a request to the apache <15> but no data is sent back <1> add more <15> so either an apache bug or a php problem <13> [EaK]Konky: caching issues are not php's problem. <16> [EaK]Konky: does it fail with lynx also? <1> hm, is apache chashing? <7> Always test every page with lynx <15> did not try lynx yet, only ff on lniux,windows and IE. caffinated: why aer you so sure it is a caching problem ? <15> i used a sniffer, and i can see a GET reqeust sent to the server <15> but no response;/ <13> [EaK]Konky: it doesn't really matter, does it? if your code is operating properly the only two places it could be screwing up at are the webserver level or the browser level. neither of which are supported here. <15> ye, the code itself is most probably no problem <15> i set php memory limit to 32mb, that's not a problem too i guess ? <17> alguien en espaol? <15> looks like some alien language! no <13> !+es <18> Para los usuarios PHP de habla hispana que requieren la ayuda, ensamble por favor el canal del #php-es <17> caffinated: :) <7> wow, php-bot has an answer for everything. <19> it's caffinated's pet <20> does the php 4.4.1 mysql_query function allow multiple queries, semi-colon seperated? <21> no <15> does any mysql_query support that ? <21> mysqli allows for that, however <22> steveb: mysqli_multi_query <20> oh sweet :) <20> thanks <19> though it's not recommended to use it with user input unless you parse it very carefully <21> probably requires a rebuild for you, steveb <1> don't think you can have mysql and msqli enabled at the same time <20> b1n0ry: i know. im going to have to do a lot of samity checking. its just that im doing things with table locks and things seem to break if the lock tables runs and another query fails <1> er, mysqli <13> there really is no point to multiquery commands <19> lot of danger in them, though
Return to
#php or Go to some related
logs:
doc++ ebuild problems +remove +drm +wmv10 Can't open named pipe to host: . pipe: MySQL (2) #perl python import egg.trayicon fc5 xubuntu install enable swapon sourceomatic Extended/2 xorg.conf #linux #math
|
|