logs archiveIRC Archive / Freenode / #php / 2006 / June / 15 / 1
marcrosoft
<base href="http://www.mysite.com" /> <---- this is usually the way we need to keep image links and such in check when creating new dir... correct?
richardlynch
marcrosoft: Maybe I'm just used to ancient browsers, but my experience with BASE tag is it is unreliable...
marcrosoft
hmm, well then the other option is to have absolute paths, thats a waste of space...
jMCg
j0!
Hello boys and girls - I'm having some PDO issues:
richardlynch
marcrosoft: My images are usually at <IMG SRC="/images" /> which only "wastes" one character for the leading "/"
jMCg
This is the site, you'll notice some.. errors [most of the blah blah is debugging stuff]: http://kg.brainsware.org/ --- This is the Navigation class I use to create a Navigation with items and sub items: http://kg.brainsware.org/classes/Navigation.class.phps ---- Here are some wrappers for PDO I wrote to catch the Exceptions it throws: http://kg.brainsware.org/classes/dbconn.dbc.phps
richardlynch
If you have to count the characters in the URL to be significant in your HTML bandwidth, then you're in trouble, or you're Google...
jMCg
[I'm running the latest PHP/pdo/blah stuff available via dotdeb on Debian Sarge]
Wolfpaws
(Action) blinks at WhiteWolf
         

richardlynch
jMCg: All I can say is that I have only heard a lot of wailing and gnashing of teeth from people who are going to the bleeding edge of using PDO. YMMV.
jMCg
Well... this is the very first time I got any issues of such an extent.
kormoc
Hihi, I was wondering if anyone in here uses memcached via the PECL memcache extention?
richardlynch
It is entirely possible that there are a billion users who sail through with no trouble, and I never met them.
jMCg
richardlynch, those who don't have any troubles don't com[plain.
richardlynch
Yes -- though some do sing the praises of the new tech -- and I ain't heard of none of that yet. :-)
jMCg
I sang the praises until this morning.
richardlynch
:-)
jMCg
[It's 23:09 now.. but I didn't work all day on it ;]
kormoc
So if I install a PECL extention to php, it should just work, sorta like a pear extention, right?
richardlynch
Try on PHP-General -- And if that fails, PHP-Internals. But it's off-topic for Internals, so go gently.
kormoc: Yes. PEAR and PECL share a lot of the installation code/paradigm.
kormoc
(Action) ponders
jMCg
richardlynch, suppose you're talking mailing lists
kormoc
this PECL memcache install installed a .so file, but it doesn't appear to be loading
richardlynch
jMCg: Afraid so. But you need not subscribe to post to General, as it's simply to high-volume -- Last i heard anyway.
kormoc: You may need to install memcache itself as its own package, same as you would MySQL the database.
kormoc
richardlynch, I mean, it's not providing the functions on the php side of things
jMCg
(Action) considers abusing google for this.
kormoc
richardlynch, unknown function memcache_connect and similar
richardlynch
kormoc: It may have failed to install BECAUSE you don't have the memcache installed, just as mysql_php functions would not install if you didn't have MySQL in the first place.
kormoc
shh
erm
ahh
but I have memcached installed and running
connects to it fine via perl and c
         

richardlynch
kormoc: What is the exact error message about the ".so" file?
kormoc
nothing at all
it just never loads it
zircu
kormoc: does it say it is installed via phpinfo(); output?
kormoc
zircu, nope, which is why I'm confused
richardlynch
kormoc: What is the exact name of the ".so" file?
kormoc
it installs into /usr/lib/php/modules/memcache.so just fine
richardlynch
kormoc: Did you edit your php.ini and add a line to load that Module? And re-start Apache?
kormoc
richardlynch, I didn't add a line to php.ini, didn't know I had to. Let me give that a shot
richardlynch
kormoc: It may already be there and you just need to take out the ; in that line.
kormoc
the documentation for PECL seems rather... lacking
zircu
kormoc: for installation?
kormoc
yeah
richardlynch
You gonna have to talk to the PECL guys about that one...
zircu
kormoc: how did you install this, is it a package php_mmcache module or you are doing this from a pecl install?
kormoc
heh, no worries, just seems like something they should of memtioned in the install directions
zircu, it's in pear, so I just did pear install memcache
zircu
kormoc: well technically it is pecl, and uses the pear installer but yea
richardlynch
kormoc: It's possible that their installer attempted, or even succeeded, in changing *A* php.ini file, but not the one you are actually using.. :-)
TML
kormoc: When it's a .so file, you need to edit php.ini and restart the web server to get it loaded.
kormoc
zircu, and that didn't work, and it's version 1.5, and on the site, they have 2.0.4 stable, so I downloaded that, pear uninstall memcache, and then pear install memcache-2.0.4.tar.gz and that installed it as well, but still didn't work.
jMCg
(Action) hopes the errors are at least somehow related in php-cli and mod_php
TML
I don't believe the pear utility does that magically.
kormoc
(Action) nods
makes sense
Narusegawa
is there a function to get all the headers of the columns in a postgresql dataresult? trying to just get all the column headers so i can make a dynamic html table from result sets without recoding it all the time
TML
Narusegawa: Use pg_fetch_assoc and array_keys
richardlynch
Narusegawa: Look for something like pg_field_name in http://php.net/
kormoc
zircu, richardlynch, TML, That did it. Thank you very much.
zircu
kormoc: yeah you are correct that it doesn't mention that you need to edit the php.ini file to enable it, i would suggest to add a documentation bug about that
installing pecl from source it tells you, edit your php.ini file
surfdue
hi :P
kormoc
zircu, doesn't appear to in my output, but perhaps it's just a bum version
zircu, yeah, I'll add that document bug. Thanks very much
surfdue
zircu, long time no talk
CBTC
ok so Im using php to process a form, the php also validates all the required fields. However I have a question which uses javascript to hide/show <tr> based on the answer. I want to have each <tr> not hidden become required fields and be validated. Could I use php to do this based on the <tr> that is NOT hidden, and not validate the <tr> that IS hidden??
MarkR42
CBTC: I think it would be better if you validate the fields for consistency with respect to each other, rather than what's shown / hidden. So use the answers of the other questions to enable/disable the validation of dependent field
I find it easiest not to do client-side validation at all, because I'm lazy and don't like doing things more than once
asdx
shall I use mysql_fetch_assoc instead of mysql_fetch_rows?
CBTC
in this case certain fields do need to be validated for an answer
TML
CBTC: Better still, rather than showing/hiding the <tr>s, you can make sure that the <tr> only exists when it is appropriate.
CBTC
but in the case of *question 10*
CrazyTux
I'm having a little bit of a problem figuring out php 5 oop and object handling accross sessions, any tips?
CBTC
I only want to validate the <tr> if it becomes visible, and not validate the ones still hidden
it seems that the way I have the validation setup it would fail if it validates all the <tr> fields hidden or not. as there needs to be some sort of answer filled in
jMCg
Once again: http://kg.brainsware.org/ --- http://kg.brainsware.org/classes/Navigation.class.phps ---- PDO wrapers: http://kg.brainsware.org/classes/dbconn.dbc.phps ---- And this is the strace -f -a 2554 I get when I run it in the console http://kg.brainsware.org/pdo_debug.txt
richardlynch
CBTC: Whatever you use to toggle the show/hide of the TR needs to change SOMETHING that gets sent to PHP. PHP has no friggin' idea what is visible on the browser. So set up a checkbox or a HIDDEN input and PHP can tell from that input if the other inputs are supposed to be there, and validate them then.
CBTC
MarkR42: could you guide me to a url that could show me what I could do to enable/disable the validation based on the answer
MarkR42
CBTC: No, you just do.
zircu
hmm.. i would be neet to have .phps files output with line numbers
TML
CBTC: Don't put the <tr> on the page as invisible. Create it as a DOM object and use the DOM to add the <tr> when it needs to be there and remove it when it's not.
richardlynch
jMCg: I would fix the Undefined index E_NOTICE messages first...
CBTC
MarkR42: well I understand the concept of what your saying, but frankly I am still a n00b when it comes to php
MarkR42
CBTC: It's nothing to do with PHP, just normal programming, use an "if" block.
richardlynch
zircu: http://php.net/highlight or somesuch gives you the lines. You add the numbers. Done.
zircu
jMCg: heh.. odd, you are changing objects to function calls? :)
jMCg
richardlynch, this has ABSOLOUTELY nothing to do with the PDO stuff.
CBTC
MarkR42: Bare with me, I'm still new to all this
jMCg
zircu, care to explain your asumption which I do not understand.
[I just did a ltrace.. which I'm not gonna paste as it's 241MiB]
zircu
jMCg: you made wrappers PDOQuery() to pass a pdo object and its options as if you called $pdo->query();
jMCg
zircu, because I would have to have handled each of the FUCKING exceptions which looks UGLY in a foreach - don't you think?
s/FUCKING//
mattmcc
(Action) ponders a fu*king exception.
zircu
jMCg: http://us2.php.net/manual/en/function.pdo-query.php
jMCg: note: it returns 'bool'
richardlynch
jMCg: Could you not wrap the try/catch around the loop?... Just asking...
xshad
richardlynch no
zircu
jMCg: it seems odd to set things up like this though
xshad
http://bugs.php.net/bug.php?id=34065
jMCg
richardlynch, yeah.. but it'd look still quite ugly.
zircu, I'm gonna try something..... hmmhmmhmmm....
TML
jMCg: Note that you're far more likely to get better help if you create a SMALL, SIMPLE EXAMPLE of the problem; as an additional bonus, if you had tried to create a smaller example, you'd like have realized your own error in the process.
jMCg
PDO needs better documentation.
zircu
jMCg: oh btw there is no need to pass objects by reference in php5
jMCg
TML, I have an example which runs with SQLite.
lexton_
quit
TML
(Action) blinks at jMCg
zircu
pdo does sqlite too
jMCg
[Which doesn't work right now because I did some nasty stuff with open_basedir]
richardlynch
Well, replacing PDO with SQLLite could be called smaller and simpler, I guess... I'm confused.
jMCg
zircu, yeah.. it's with the same PDO functions but operates on an SQLite database.
richardlynch, ^
richardlynch
I think TML was looking more for ripping out everything but the PDO stuff, rather than swapping sqlite/mysql...
tdd1984
http://indianaclassifiedads.com/categories/classifieds/contact.php?type-id=108&userid=34 I was curious how i can upload images that will be thumbnails to my website at this page where the current images is, but with like 8 small images?
if there is a tutorial out there explaining how to, or etc?
richardlynch
tdd1984: http://php.net/gd http://php.net/imagemagick and about 10 billion tutorials/examples/packages under Google "PHP Thumbnail"
tdd1984
I was thinking of the gd function
zircu
jMCg: i'm having troubles even trying to come up with a solution cause if you are using pdo, you should really take advantage of prepare(), bindAttribute() and execute()
richardlynch
tdd1984: http://php.net/imagecopyresized or http://php.net/imagecopyresampled would be a fine answer, with examples.
jMCg
zircu, right now I'm trying both: feeding the object with bindAttribute() and making the SQLite example run.
[The latter just to prove myself, that it actually works.]
f4ruk
hi all
what is?
Fatal error: Call to undefined function: mysql_connect() in...
tdd1984
richardlynch: so i can have the image automatically resized too
xshad
what does it looks like?
CBTC
ahhha
tdd1984
i mean renamed sorryl lol
richardlynch
tdd1984: Yes. That is what those functions *DO*
airwave
Is there a limit to how long the command can be in the exec function?
richardlynch
tdd1984: You can name them when you output them with http://php.net/imagejpeg and friends.
f4ruk
Hi
al
richardlynch
airwave: Not from PHP side, but I'm sure the shell/OS has a limit.
xshad
!tell f4ruk about enter
richardlynch
f4ruk: You have not successfully installed PHP MySQL extension.
CBTC
ok I understand how to make the php validate if the questions are shown, but how do I get the php to understand which answer was chosen?
tdd1984
k
surfdue
yall talk to much
shh!
f4ruk
xshad, escuseme, mi english is very bad
tdd1984
richardlync: so basically this is a simple function that does the work for you by renaming reszing, and etc
f4ruk
i am brazil
surfdue
shh!
« 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 32 next »