| |
| |
| |
|
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
Comments:
<freeone3000> TML: How should I handle something like that? Can I ***ign the value of a constant to a variable? <kuja> You ***ign the return value to a variable. <freeone3000> kuja: <AzMoo> freeone3000, $funcName = 'doStuff'; $funcName(); <TML> freeone3000: That's not a method, that's a method *name* <freeone3000> TML: It does the method, does it not...? <kuja> Yet, it isn't a method. <freeone3000> Okay. I have erred. It is the NAME of the method. <freeone3000> So... how would I ***ign the value of a constant to a variable? <TML> freeone3000: Why would you? <TML> They're constants for a reason <freeone3000> TML: So I can refer to diffrent things based on the value of another thing without having to switch based on the value of the other thing... <freeone3000> Basically, I'm dealing with databases. I have this thing to query for the results. If I use MYSQL_***OC in the $this->query_name(), it obvoiusly won't work for postgre. <TML> freeone3000: Which is why things like PEAR::DB subcl*** the database cl*** for each particular database type. <freeone3000> Oh. That's smart. <freeone3000> I am an idiot. <kuja> Heh <freeone3000> So basically, there isn't a way to do it. <TML> Not a *right* way, no. <alphablue> I have an array, the contents of which I want to store into a database.. what's the best way to do that ? In otherwords I want to take the output of print_r($array) and put it in a db .. (without the html that is) <freeone3000> Is there a way that works >=50% of the time? <TML> alphablue: Well, firstly, print_r() doesn't generate HTML. Secondly, what is the purpose of storing it in the database? <jonez> freeone3000, if you don't mind using stuff in PEAR, DB is a pretty nice module which I've used, and supports postgre *and* mysql (and a couple others, iirc). <alphablue> tml: a poor man's cache .. there are two columns that matter, searchphrase and lateralphrases <alphablue> searchphrase is what the user enters, lateralphrases is what I get back from Wordtracker (it's an array) <TML> alphablue: By "a poor man's cache", do you mean "to persist them across pages"? <alphablue> to persist them across multiple sessions, 3 people can search for the same phrase (virginia golf course), so instead of my script hitting the wordtracker web service 3 times , i'd rather just do it once <freeone3000> Okay, Fine! I'm using pear. <TML> alphablue: You'll want to serialize it, then. <freeone3000> ...Now to figure out how to use pear. <TML> alphablue: At least, if you're to have any hope of sanely bringing it back to PHP as an array <jonez> freeone3000, http://pear.php.net/DB <alphablue> tml: thanks, thats what I was looking for <jonez> freeone3000, I can help you (though I am going to bed soon).. there is also #pear on this network if the manual is not helpful to you. <alphablue> i've been having serious issues with my brain farts today <keeke4> i've got a newbie php question if someone's around. <jonez> we've all left. sorry. <alphablue> someone just left actually <Artnez_> keeke4: dont ask to ask :) <keeke4> i'm not looking for a lecture on 'best practices' or anything like that... i just want to know why this isn't working : http://php.pastebin.com/574510 <keeke4> wamp is giving me this error: Parse error: parse error, unexpected $end in c:\wamp\www\aitp\alumnisearch.php on line 78 <crookedi> keeke4, probably missing a <crookedi> } <keeke4> yeah. I've been looking for one that I'm missing. Can't find it. <TML> keeke4: Have you checked all of your include() files? <TML> keeke4: And you realize this script is riddled with SQL injection attacks, right? <Ox41464b> Line 78? that page only have 76 <TML> Ox41464b: More importantly, that page has no parse errors <keeke4> TML: commented the includes, still throwing the error. and yes, I'm aware of the vulernabilities. I'll be doing input sanitizing when I can get it functioning. <Ox41464b> remove all include, and re-paste <Artnez__> What was the question? Connection to a dump... <Artnez> *took <TML> keeke4: The page as you've pasted it has no parse errors. <keeke4> here it is again...http://php.pastebin.com/574514 <Ox41464b> what the error now? <keeke4> Parse error: parse error, unexpected $end in c:\wamp\www\aitp\alumnisearch.php on line 78 <Ox41464b> ....? still 78 ? <keeke4> probably would help if i saved my changes... <keeke4> Parse error: parse error, unexpected $end in c:\wamp\www\aitp\alumnisearch.php on line 74 <TML> keeke4: No parse errors there, either. You're not telling us something. <TML> keeke4: Do you have any auto_prepend or auto_append files? <keeke4> ? not that I know of. <keeke4> checking the folder for .htaccess files <keeke4> nothing in there. <TML> Well, there's no parse error here. <Ox41464b> some where before Line:74, add: var_dump(get_included_files()); <keeke4> sigh. this is frustrating. i'm just running it on a fresh WAMP install. <keeke4> just changed the error to be on line 75. <Ox41464b> ... the var_dump() works? <keeke4> nope. just getting the error. <keeke4> (on a different line) <TML> keeke4: Give us a URL to the source right on your machine. <Jymmm> Yo wordNazi! <mik1> Hi, All. I have a question. My PHP Version is 5.1.2, and My OS is linux, I had compiled the php on apache 2.0.53, and I had compiled the module PDO, so, when I echo the constant "PDO_ATTR_ERRMODE", it show a string "PDO_ATTR_ERRMODE". <mik1> why? <mik1> Thanks <keeke4> the localhost url. or my IP? <TML> keeke4: Your IP <TML> mik1: Don't quote constants <keeke4> let me play the port game... hang on <mik1> TML: I don't quote constants <TML> mik1: So you have: echo PDO::ATTR_ERRMODE; ? <mik1> it is very strange <mik1> TML: thanks. I am try it. <alphablue> TML: even if I serialize something, it's still a good idea to run mysql_real_escape_string on the serialized value right ? <keeke4> TML: http://63.238.156.160:8500/aitp/alumnisearch.php <TML> alphablue: No. <TML> keeke4: To the source <mik1> TML: hi, had found the document, the constant is not exits. but in this web page: http://www.php.net/manual/zh/ref.pdo.php#pdo.drivers <keeke4> ah, okay. <alphablue> how come ? (if i stripslashes) when i do the select ? <mik1> there are some source code like this: $dbh->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION); <TML> alphablue: Well, I guess if you stripslashes() on the way back. <keeke4> TML: http://63.238.156.160:8500/aitp/alumni.txt <mik1> and is it old-fashioned <mik1> and is it old-fashioned? <alphablue> just trying to reduce the chances of a serialized string that may break my insert <TML> mik1: Everywhere I look on php.net/pdo, it says PDO::ATTR_ERRMODE, not PDO_ATTR_ERRMODE. <TML> mik1: Perhaps the translators in your language are behind. <mik1> TML: thanks. <Ox41464b> keeke4: i have no problem with php -f with your code <Artnez> keeke4: if you name the file .phps -- you will get source code highlighting :) <keeke4> this may help: http://63.238.156.160:8500/?phpinfo=1 <crookedi> keeke, have you tried copying from your pastebin and running that, could be some sort of strange whitespace issue <Artnez> crookedi is right .. i've had that happen once <TML> keeke4: Well, I can't figure out what you're doing, but there are no parse errors in this code, either as pasted or as delivered via .txt from your site. <keeke4> tried it. same deal. <Artnez> keeke4: try to incrementally delete pieces of the code <TML> keeke4: Put '<?php phpinfo(); ?>' in the same directory and see if you get a parse error. <keeke4> works. <Artnez> keeke4: try to incrementally delete parts of the code <TML> ha! <TML> keeke4: You have short_open_tags off <keeke4> bloody hell. <crookedi> lol <Artnez> TML: you good.. you vewy vewy gewd... <TML> keeke4: This is why we give lectures on best practices <keeke4> Yeah yeah :P <TML> Because they *ARE* best practices <tama00> okay say i got a structured diagrame p***ing custermer information, do i write "custermer information" or do i lable all the information such as "name" "stree address" "city" etc..etc..??? <Artnez> i wanted to say something about the short tags, but figured i'd stay on topic... turns out it was the topic :P <Ox41464b> <?php vs <? <Ox41464b> thats the problem? <TML> Ox41464b: yes <Ox41464b> wew.... never got that before <Artnez> Ox41464b: aren't short tags <?= <zampa> <?php > <? <TML> keeke4: Additionally, by trying to dictate the terms of help, you made it harder to help you. <TML> Artnez: <?= and <? are both short tags <TML> Artnez: Anything besides "<?php", really. <Artnez> holy chazwazzers.. this i did not know... <Artnez> and this will be out in PHP6? <TML> That's the word <zampa> hm <Artnez> come on.. why the hell? <zampa> I should start reseaching about PHP6 :> <TML> Artnez: Because <? already has meaning <zampa> to see the changes :> <Artnez> c-rap. crap crap crap. i never thought it was an issue, otherwise I wouldn't have been doing it for so long. <Artnez> thank god for find/replace :) <TML> Artnez: "<?" had meaning for almost 30 years before Rasmus ever even *though* of PHP. <TML> s/ough/ought/ <keeke4> I appreciate the help, guys. <keeke4> Goodnight. <Artnez> well i've only be alive for 20, so it's not my fault.. ha. <TML> Artnez: It's only your fault for *using* it <Artnez> TML: Yea. Damn. That hit like a ton of bricks. Ugh. <Artnez> I need a smoke, be back. <HowardTheCoward> Is there a shortcut for loading the contents of a text file into a string variable. or shall I use fopen/fread functions ? <caffinated> file_get_contents() <Ox41464b> back to basic: http://id.php.net/manual/en/language.basic-syntax.php <HowardTheCoward> Ox41464b, thanks, that was what I needed.
Return to
#php or Go to some related
logs:
mjmwired azureus java.lang.UnsatisfiedLinkError postfix wrong fqdn returned skinfusionz vanilla linux kernel fatx support #web #web rename column name mysql syntax cubepanel +gentoo ubuntu k3b mkisofs missing pathspec #web
|
|