logs archiveIRC Archive / Freenode / #php / 2006 / June / 2 / 1
||cw
those should be delete from the net and the writers slapped with angry puffer fish
JJPeerless
$query = mysql_query("SELECT timestamp FROM ipods_posts WHERE ticket_id = '$id' ORDER BY timestamp DESC LIMIT 0, 1"); is that a valid query? because when i do mysql_fetch_row() on the result..i get a warning
zircu
hmm..
richardlynch
||cw: They have an agenda of not using "or die" because it's not really the Right Way...
JJPeerless: Read back about 20 lines... :-)
||cw
richardlynch: yeah, the right way is to put it on the next line, but they should still have it
richardlynch
||cw: The right way is to error_log it, or use trigger_error() and customer error handler or... Anything but die().
zircu
of course a graceful error should be caught
as well
JJPeerless
i have the or die, but it still giving me Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
||cw
JJPeerless: pastebin the code
         

richardlynch
JJPeerless: What are you passing into mysql_fetch_row() Print it out. What's in that variable?
JJPeerless
ok, ill try that
im passing ($query)
richardlynch
$query is probably "SELECT * from blah" You probably want $result instead...
Whatever is in front of ... = msyql_query($query);
ElliottHird
JJPeerless: I'm passing ($out)
Remowylliams
Hello everyone, does anyone know if I have to use a specific client flag for mysql_connect so I can perform a series of transactional queries?
purefusion
for case statements, can I have something like case: 'download' || 'download2': ??
essentially, I want to run the same code for both cases
richardlynch
RemowyWillaims: Not for connect. Just use mysql_query("BEING");
||cw
Remowylliams:
Remowylliams
BEGIN you mean?
richardlynch
purefusion: case 'foo': case 'bar': /* code here */ break;
||cw
hehe, being
richardlynch
Yes, BEGIN.
Remowylliams
Oooh so each step till the end.
purefusion
richardlynch, ok thanks!
richardlynch
It's just another query.
Remowylliams
thanks
zircu
mysql_query('OR NOT BEING');
gymsmoke
damn meetings... waste of time
mattmcc
Always take a laptop to meetings.
gymsmoke
if i show tables and echo "table:{$row[0]}", it displays the table names, but if i use echo "<option value=\" {$row[0]}", nothing is displayed...
         

mattmcc
That way you can be productive despite them.
Wolfpaws
always *&avoid* meetings :)
gymsmoke
mattmcc: good idea... i could keep up with the channel that way
richardlynch
One of the Beowulf guys has a cluster in your basic red toolbox, so he can work on his cluster in meetings...
Wolfpaws
gymsmoke: o.O
gymsmoke
Wolfpaws: i don't understand
richardlynch
gymsmoke: The VALUE= bit is what gets sent back if they choose it. <option value="VALUE">User sees this bit</option>
Wolfpaws
gymsmoke: The ultimate geeknes... Taking the laptop to the meetings to spend your time on an IRC channel...
ElliottHird
take your laptop
to talk in an irc channel
gymsmoke
Wolfpaws: DOH! yeah, i should have added the label portion to that option statement, but it doesn't seem quite there either...
ElliottHird
with people in the same meeting
gymsmoke
Wolfpaws: hey, i like it here... i learn alot... which is more than i can say for managers who just like to hear themselves talk
dbruns
k guys, I think i found a legit reason to use eval() I'd like some input on this as to whether or not there are other ways to accomplish what I need
Xyphoid
Neat stats, heh
ElliottHird
dbruns, false alarm
there is NEVER a legit reason to use eval()
dbruns
yes...
i think i found one
the personalized google home page
with the 8 8 3 3 puzzle
variable mathematical operators
Havard
ElliottHird: I use eval() to be able to use PHP in the news posts on my web site.
richardlynch
dbruns: If the number of operators is small (and it is) and they are all known beforehand (and they are) then a simple switch/case will do. N need for eval.
redrain
I feel really stupid, i've read fileftime, opendir, readdir etc. but still can't add "latst modified" order to this script: http://pastebin.com/752198
Xyphoid
uh, I have a legit use for it. it's just not *recommended*.
Remowylliams
Great be the goodness of transactions. :)
thank you
samuel
using the query: "SELECT `fieldvalue` FROM `editor` WHERE `fieldname` = 'wikilink'" is there any way to get the result NOW? as in the one result without doing the fetch_row and then getting the first row?
contraventor
redrain you script of upload photos ?
Xyphoid
samuel: you could just write a wrapper of your own to get a single field in one go
richardlynch
redrain: Get all the files in an array, use the filemtime as the key or value, and http://php.net/asort it.
samuel: No, but you could use LIMIT 1 and mysql_fetch_result() to make it more clear you are getting only one value.
redrain
contraventor: No, it lists 8 files in a directory
richardlynch
samuel: Errr. The LIMIT 1 bit is not needed if you KNOW there can be only one.
contraventor
samuel you talking from brazil ?
redrain ;)
Xyphoid
i should write one of those actually, that spits the dummy if I get multiple rows or fields out of it - it'd make for clearer code
TimJR88
Does any one know of a windows hack so that when I rightlick in a folder and hit "new" I could have a php option?!
gymsmoke
what's the right way to format this line? i keep getting parse errors... $opt .= "<option value=\"" . {$row[0]} . "\">" . {$row[0]} . "</option>\n";
zircu
there is also: list($my_field) = mysql_fetch_row($result);
samuel
richardlynch, i was just wondering to see if there was something to cut access times, but ok, thanks!
contraventor, nop, mexico, why?
mexico city
contraventor
samuel nothing
richardlynch
samuel: The access time is negligible. Measure it.
zircu
or use mysql_result()
contraventor
gymsmoke using function while for printing ..
richardlynch
gymsmoke: If you use the . you do not need the { } as well. Also, get an editor that syntax highlights.
mattmcc
mysql_result only pays off if you're getting one field, imho. Even then, I question if it's much of an advantage over just fetching the row, even if the row has one field.
Xyphoid
timj: it's called a context menu, google has info on how to modify it
zircu
that is the case according to the query stated
contraventor
while($x = mysql_fetch_array($query)){ ..
TimJR88
Xyphoid: Ty
Xyphoid
mattmcc: Not much performance advantage, but I like the idea from a intention-revealing point of view
gymsmoke
contraventor: i was using mysql_fetch_row
richardlynch
mattmcc: It's no advantage in performances -- merely in code clarity that you ARE getting just ONE thing.
Xyphoid
snap
Stephanie
Oh snap.
richardlynch
Let me get my towel. :-)
Vooloo
anyone else think smarty is stupid? now I gotta learn another language just to template this system... smarty..
zircu
then down the line you need another field fetched... i question its use as well, i use it mabey .5% of all my query fetches
Wolfpaws
Vooloo: most people here hate Smarty
richardlynch
zircu: If what you are getting is, like, a singleton, and will always be a singleton, I find it helpful to self-document the code.
gymsmoke
if i take the '{ }' off, nothing displays
mattmcc
Vooloo: There are other ways to do templates.
richardlynch
gymsmoke: Nothing at all, or just nothing for the $row[0] bit?
Vooloo
mattmcc: I know but these guys choosed that.. it's basicly php reinvented ffs
Xyphoid
i use smarty, but that's just because my designers are trained up on it
gymsmoke
richardlynch: nothing for the $row[0] bit
richardlynch: the select list is empty
Vooloo
Xyphoid: I bet they can learn php if they can learn smarty
richardlynch
So maybe the query is wrong, or the db has nothing in it, or...
Xyphoid
oh, probably. i'm not going into advocacy
richardlynch
I would go so far as to say Smarty is one of the least-flawed template systems, if one is forced to use a template system in the first place. :-)
gymsmoke
richardlynch: i select "show tables" and echo "table: {$row[0]}" and it lists exactly as expected
richardlynch
gymsmoke: Use "View Source" in your browser...
Xyphoid
generally if you find yourself using anything more than foreach and the var echoing syntax you're probably putting too much logic in there anyway
gymsmoke
richardlynch: i'm vieweing it through ff webdev... the select gets output, but no <option>'s ...
richardlynch
gymsmoke: Pastebin your code. You probably aren't doing the $opt .= part right, or maybe you are echoing something other than $opt ... Check for silly typos, or fora place where you do $opt = instead of $opt .= near the </select> bit.
gymsmoke
richardlynch: ok
lightbringer
Anyone have ideas why Bcc: and Cc: don't seem to work with mail()?
I grabbed this script from someone, and everything to works but Bcc:.
richardlynch
lightbringer: Unless you've messed up sendmail config, they work fine...
lightbringer: Pastebin it -- And check with webhost to see if they've disabled Cc: and Bcc: on you on purpose, to foil spammers.
lightbringer
Pastebin it here, you mean?
richardlynch
gymsmoke
richardlynch: http://pastebin.com/752241
lightbringer
I know, but give you the link to check out the source?
richardlynch
Yes.
gymsmoke: $optionList and $optionlist are not the same. Capital L matters.
gymsmoke
richardlynch: sorry, fat-fingers
lightbringer
richardlynch, http://rafb.net/paste/results/kIEgHw74.html I've tried replacing the variable with the e-mail string manually, I've removed that if.
Like I said, it works except for Bcc: (I've also tried Cc: and used different addresses)
(as in tried Cc: and that didn't work either)
richardlynch
lightbringer: Everything LOOKS ok... Maybe try and echo $headers right before mail() to see if it's what you expect. But check sendmail config for Cc and Bcc settings being disallowed.
lightbringer
Okay, thanks.
richardlynch
lightbringer: You could also try a Cc or Bcc without all the MIME crap -- That would eliminate/confirm the sendmail config issue.
altoid
hmmmm, anyone have any ideas on this:
php: error while loading shared libraries: libpq.so.2: cannot open shared object file: No such file or directory
lightbringer
I have a feeling
it can't find libpq.so.2
richardlynch
altoid: You need to install PHP PostgreSQL extension correctly.
altoid
that's odd, nothing major has changed on this box since this script was run (and worked) last time (a few months ago)
redrain
richardlynch: Could you please have look at this: http://pastebin.com/752261 I couldn't find what's the problem
altoid
thanks
richardlynch
redrain: You cannot assume that readdir() will do things in any particular order. It won't.
khaladan
how can i get the ?part&of=the&url=after&the=question&mark
richardlynch
redrain: You MUST read all the files, and then find the 10 most recent.
khaladan: var_dump($_GET);
zimnyx
What is common name for housing estate? it is good term?
richardlynch
khaladan: If that's not what you want, surf to http://yourserver.com/phpinfo.php?test=test
numist
hrm...
gymsmoke
richardlynch: i mis-typed it in pastebin..
riqn
khaladan, you can access the url with $_SERVER['REQUEST_URI'] i think it is
richardlynch
gymsmoke: The purpose of pastebin is to, errr, copy and PASTE. Do that. All the lines down to the print of the $optionlist
redrain
richardlynch: Ok, but I couldn't find how? What is the problem with my script?
« 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 next »