she doesnt even know what shes creating and shes trying to create tables one of thosee tables being called calendar

s

is it MySQL? it’s a TIMESTAMP datatype, or a DATETIME?

PovAddict, i haven’t added the field yet, im neutral on that

I can’t help you decide, sorry… I have had trouble with both :P

PovAddict, oh dear :O

aria2 is the *best* if you want to download, for example, a single multi-GB file from multiple mirrors at the same time… but I don’t know of any multithreaded crawler (other than free (or paid!), closed source, and Windows only)

NemesisD go with integer and use time() function

heh

in php

unix timestamps ftw
especially if you use 64bits to avoid the Y2038 issue
Unix’s version of Y2K bug

but what if i want mysql to do the work figuring out the timestamp?

to store current unix timestamp on an int field… set field=unix_timestamp()

its kind of a just in case field, no scripts will access that field

to store current time on a timestamp or datetime field… set field=now()

hello! i am trying to get image magick wrapper working with php on windows (xampp). does anyone here have experience doing that?
sometimes i wish i was using the same operating system as my host

dont say that
you dont mean it

that i should be running linux? hell yeah i should.. unfortunately it’s so damn time consuming

oh nm i thought your host was on windows, and linux isn’t too time consuming in my experience once you get everything going the way you like it
is integer literally a datatype?
PovAddict, should i use bigint or mediumint or what

int is 32-bit, mediumint is… I think it’s 48 bit, bigint is 64-bit

who uses mediumint?

people that need to store really big numbers?

i think ive used it

i suppose.. i guess if i was ever in that situation i would go big

MEDIUMINT is 3 bytes according to php mysql web hosting website

… really?

wait mediumint is smaller than int
ooh burn

yeah so I got that wrong…
it’s 24 bits
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

http://www.google.com/search?hl=en&q=24+bits+in+bytes&btnG=Google+Search

I usually seem to go with int(10) and I don’t even remember what that means :P

PovAddict, but int is big enough for now() right?

now() won’t give you something you can store on an int

oh wait yeah

it will store it in the format YYYYMMDDHHMMSS which is quite annoying to work with

yeah your living in the past

use unix_timestamp()

ill write a function for it
why

0 on january 1st 1970; works nicely on an int until year

and when does now() break?

1000000000000000…

first, if you want to use now, use a datetime field
and, arithmetic screws up
you need to use special mysql functions, you can’t just substract ‘em
how much is 20070101000000 – 20061231235959 ?

i don’t really need to handle the timestamp, its just a precaution so if theres some sort of descrepancy i can look when something was added

it should be 1 second, but if you blindly substract them as numbers… :P

8869764041

281 years
fun-to-find bugs

Is it wise to store images in databases, or is it better to store its path and link to it?

not in db
that will take massive amounts of space

it is better to store its path and link to it
definitely

Each has its pros and cons

okay, thanks

store the path to it in the db

such as?

then you can just link it up

PovAddict, ok so INSERT INTO t1 (`foo`, `bar`, `timestamp`) VALUES (‘oof’, ‘rab’, now()); ?

No
unix_timestamp

yes, after you have created the table with timestamp being a timestamp or a datetime
if `timestamp` is an int, use unix_timestamp(), not now()

it will be datetime

now() will do then

i just want to call the field timestamp because it sounds cool

Eh, I don’t have a list off the top of my head, but each one has its pros and cons but using a filesystem is adequate in most cases.

use ‘foo’, ‘bar’ and ‘thingy’
will make things interesting in a few months when you try to figure out what they are

lol

haha, yea. I’ve done that before.. ooo the fun.

time 10:57pm
latin zone :P

and I named a column after a MYSQL keyword, which was oh so fun too.

1234567 && 987654 and so on

accidentally, of course, but I was lazy on quoting. Go go sql errors

Though the final choice is yours, I just don’t see many people using datetime fields

Slynderdale, normally id do that but it wont have to be manipulated, its a field that will be ignored by all scripts and will not be manipulated
wait i shouldn’t call the field timestamp then, doesn’t that count as a mysql keyword

if you use `quotes`, I THINK you should be fine

And why not use timestamp instead? You never know when you might need to rely upon it in the future, but heh, its your script. Datetime isn’t bad, just not as easy to work with.

I have seen arguments against TIMESTAMP
but well… isn’t it good we have the choice…

Slynderdale, because unix timestamps aren’t very readable from a simple query
select * from bleh;
which would seemingly be solved with datetime

rofl, i just created a new vhost, a directory i thought didnt exist, restarted
it was full of sql dumps XD

URL?

http://www.webmasterworld.com/php/3012922.htm That page has some example functions to convert datetime ysql fields into timestamps and so on
a href=”http://www.webmasterworld.com/php/3012922.htm”http://www.webmasterworld.com/php/3012922.htm/a That page has some example functions to convert datetime ysql fields into timestamps and so on

Slynderdale, i will not be retrieving the timestamp/datetime field with php though

wow

poopy

wtf happened ?

chansplit

oh

netsplit actually

that was weird

it happens a lot

preg_split :P

http://www.youtube.com/watch?v=gG47XxbFGow&mode=related&search=
ha ha! revenge

hey does anyone know how to make text bunch up around an image?
like lets say i have a picture 89×290 (a long picture)
i want the text to stay with the picture without it breaking

how is that a PHP-related question?
are you editing the image host with GD?

sounds like an html/css question to me
try #web

it is but theyre all deeaaad

echo “img style=’float:left;’ /”;

#css

hey its php

scragg, your so clever

“channel is dead” is no excuse to ask on another where it’s offtopic

hmm when ##php is dead I should stroll on into ##csharp and ask

or not

how can I change the page, without sending headers?

why no headers?

because i’ve printed and echo’ed some stuff before

use output buffering

I want to change page, after all php work is done
in php.ini?

what is the best way to do this Select column from table where column = $title i want to know if there are any results i tried mysql_num_rows but then i get a warning

is that what you usually do?

ob_start(); echo stuff; send headers; ob_end_flush(); echo some more stuff…

huh
so do I have to define ob_start()?
or it’s a built in func?

http://php.net/ob_start

thx
is this what you usually use?

Hello
can somebody tell me if there is an error please

est ce qu il y a une faute dans ce script

$headers=”From: “.$email1;
mail($email2,$titre,$message,$headers);
include(“anonymous2.html”);
?

impossible to know from that
you tell us; is it working incorrectly?

no just if there is an eror in this code

Le-Moche, as you present it there are no syntax errors

cythrawll ok thank you

Le-Moche, how do you know if there is an error?

if that’s the only question… Try It And See!

cythrawll don’t know lol

php interpreter will tell you if it sees an error
better than us

is there in a site ?

Le-Moche, then I think you better re-evaluate your debugging!


you’re coding PHP without having an interpreter?
“coding blind”?

PovAddict i don’t code , it is only a friend who asked me ..

replace ‘you’ with ‘your friend’ on my previous sentences then

Pov, do you know if I can use ob_start(); all my code with echoes and other funcs 0b_end_flush(); send headers;?

ob_end_flush sends all the stuff you echoed

PovAddict i don’t know if he have ..

you need to send headers before that

ok. my intension is that, when all the code with echos is processed, then send headers..

PovAddict
i want some thing like that
http://www.x-mindfreak.com/index.php

that’s absolutely basic PHP
so go learn

I should probably just call a js?

Lol

what on earth does JS have to do with this?

well, I know I can do that with js,
but how do I do it in PHP?


JS is client side
PHP is server side
nothing to do

omg

btw, if you send the headers to redirect, the user will never see what you echo’d, so I really don’t see the point

I need to change the page after the browser renders php outputs…

why? you first send content, then load another page? what is the content for if it lasts a second?

ic, well I though PHP would have some sort of time out function..

you’re still mixing things up
PHP is server side

yes

j #pperl

you are right
so, basically if you are going to change the page, you can’t output any message, like files uploaded successfully, changing page..?

that’s not done with headers

so, how could I do that?

you can use either JS, or output a Refresh meta tag
in either case, automatic redirecting after a few seconds is a bad idea in concept

you say that a headr cant be used if php has posted some content?

everybody does it, but it’s a bad idea

so how do I make a logged in bar
I want to have something like

ic, so, after all my code is done, I simply echo a JS?

the headers are sent before the contents…

Welcome, (username) (logout)

heh

we’re talking about completely different headers

where username is obvious, but logout is just a link to the logout page
huh?

everybody is talking about different things
lol

i was not taking about YOUR conversation

hehe

I just set my attention to the channel just now
and am not aware of what youre talking about

then why do you comment about it? :P

you say that a headr cant be used if php has posted some content?

a quick scan in the buffer reveals you were talking about headers just as I had a header question
…a coincidence

oh

you see, I am working on my template, when its done, im pasting it in all the pages that require the user to be logged in
I just finished my menu placment
which was a pain
and now I need to add a way for the user to log out
because at the moment, they stay logged in indefinately
as a matter of fact
how can I set a time limit on how long they can stay logged in?

are you using cookies?

no, im using a session variable

ugh, no idea then

last time I tried to use PHP’s builtin session stuff, I decided it sucked

oh it works quite well for the login stuff
i dont really need a time limit, tbh
now then

Pov, how can I check with php if a mysql query was performed?

so to display a variable value, i just use echo?

it’s recommended that you use a time limit

mysql_query returns FALSE on error, like the manual clearly says

ic

have any idea how to do it with php sessions?
i dont want to use a cookie

sessions use cookies anyway

aye, but I mean using cookies in other ways
other than using the built in feature of session

uh
I assume you have checked the docs?

I dont think there is

where’s php-bot :o

because cookies are the only thing transferred over pages

nice, 2.15 am
my parents will kill me :]

well, sessions can be implemented using GET requests
but i can’t imagine that that would be the default.

I just thought of that

$_SESSION['username'] = $username;

try it and see?

hey guys, okay so sending an email. how to change the width of the word wrap. Is there a way? Discuss…
I’m guessing it’s specific to the program, I’ll manage it myself

please look at the PHP manual before asking questions on IRC.

anybody
help with GD image crop
imagecopyresampled($image_p, $image, 0, 0, 50, 50, 150, 150, $wo, $ho);
this code stretches only the original image to 150×150

specifically, the comments.
It took me very little time to find, excepting my slow net connection.

is there a way in a foreach loop to goto the next line without evaluating the rest, rather then putting everthing in an if statement ?

!+continue
!+func continue
Anyways, try continue;

you dont have to answer any question I ask. and if that manual was better put together, I would reference it more

thanks

i cant stand badly put together manuals. take the msdn site, for example. it was horrid to find the information you needed, but now they wisened up and its simple to find stuff
haha, and session_destroy() doesnt seem to work
oh wait
I forgot

You aren’t very good at reading the manual. it took me to go through the table of contents, go to one page, go to the next, more obvious page, and read the first comment.

yes it does

If you don’t read the manual, don’t ask stupid questions.

‘you arent very good at reading the manual’ heh, that much is certain, and I am not you. just because you find the interface easy to navigate though doesnt mean I will
please do not compare what YOU are capable of doing with what I am

You can also quick loop up information like php.net/session_destroy oe php.net/sessions for that matter

just ctrl-f for expire on the session page…

heh I resolved my own question on that one

it doesn’t take much intelligence, tbh

I have resolved the issue
nice
it works
whee

I hope you aren’t using a messy solution. :/

not at all

the correct solution is ini_set(“session.gc_maxlifetime”, $time); , as the comments say, anyway.

you cant use session_destroy() without calling session_start() first.

scorch, I was fixing my logout page

last time I checked you were looking for how to set a time limit.

what are you talking about? no no I had set that issue to the side
haha
but, thank you

well you have the solution to it now

hi, how do I generate a random number between 1000000000,9999999999?
mt_rand(min,max); isn’t working this way

in mysql, is there a way to automatically delete a row from a table, if one of the columns in the row is less than a certain number?
hamyai, I’m not sure its possible to have an integer that large

HaMYaI, php.net/rand

he is saying between a million and 9 mil…

no he isnt…

sorry

thats one trillion

heh

yeah, but from my searches mt_rand is better than rand

it doesnt matter
currently the largest number php can hold may be smaller than that
in that case, you are sol

it produces larger range probably
umm, in my case it’s too big I believe
is there any other way?

thats what I just said
no

DELETE FROM tablename WHERE column certain_number;

I dont want to constantly run queries like that
I want mysql to automatically do it

i c, that i’m not aware of

when using the system() function is there a way to put the output of that command into a string, the only info i can find is if the command returns true or false

strstr(strtoupper(substr($_SERVER["OS"], 0, 3)), “WIN”) ?
$sep = “\\” : $sep = “/”;
i see “WIN” there. does that mean windows?

It’s a terany operator.. strange one though. It’s basically a one line if/else

the explination was saying something about it being platform independent
http://www.captain.at/howto-php-sessions.php
im trying to understand that

it looks like its testing the os of a browser probbly

if (strstr(strtoupper(substr($_SERVER["OS"], 0, 3)), “WIN”)) { $sep = “\\”; } else { $sep = “/”; } would be one way of writing it, and yes, if the OS is windows the seperator is \ if it’s something else, the seperator is /

ah ok

What someone probably wanted was DIRECTORY_SEPARATOR … heh.

yay
huh
directory_seperator?

Yes, it’s a constant, already predefined for use.

Why donot use PHP_OS?

you mean that line can be rewrtten?

Yep… $sep = DIRECTORY_SEPARATOR; would be all you need.
Assuming I’m spelling it right.

seperator

See

i can include all that stuff in my config.php before the session_start(); function, right? or does that stuff need to be called only once?

hey can any1 help me

neo_, any1 is not here right now. Sorry.

hmm i dont think it would matter, as long as it is called before session_start()

hey i am really having a prob ,plz dont make fun

session_start must be called before any normal output is sent to the browser.

Then type properly and we’ll help.

s/browser/user agent/

i am using a ubuntu x64
and i can’t download flash

Does the exciting PHP part come in now with explosive blazing action, or what?

I suggest you try #ubuntu then. This is ##php – not a place to ask about downloading flash into Ubuntu.

ok

hahaha
that example does not work
i get ‘permission denied’

What’s the whole error message?

mkdir() [function.mkdir]: Permission denied in …/config.php on line 92

What OS?

OS X
Unix
darwin

Hmm… so permissions should be similar… well, you need to allow read/write/execute access to your web server’s user so that it can create the directory.

oh thats right!
i created limited access for this user
but…
I was told to create limited access
should I give the user write access?
or is that not safe?

This “user” is the PHP engine?

oh wait
hah

If you’re wanting to make a directory, then yes, the user will need write/execute access to the parent directory.

If you don’t need the permissions, fine, you shouldn’t grant them, granted.

im thinking of something esle
i was thinking of my mysql user
huh?

damn.. my english

you can’t tear things apart with hammers
and besides

Sure you can.

no, you can only crush

It just takes much much much more patience.
And you need to use the pointy end.

wait i am confused

with an enter key?

is this the mysql server that is doing the folder creation?

nevermind.. my English suck.. keep making fun of me

You can also take things apart or crush things with an Enter key, but I would recommend a hammer…

the mysql user, yeah

so was I correct to say that I need to give the mysql user more access?
ah ha!

No, it’s PHP itself, running as your web user.

?
youre givnig me conflicting information

which is the mysql user
and not PHP

ah I see

Er, how can you create a directory through MySQL?

afaik, anyway. My MySQL installation has its own user

soo what do you all think? is it safe to give the user access to create folders?

You don’t. It does.

MySQL is not only for PHP *sigh*

No… really?!

mysqld is a service, BigE.
Well, which user?
It does not imply that the error is a PHP error.

that is easily explained by PHP being the program using MySQL

can someone explain the diff between == and ===

well, i have root, which has all access of course, and trunk, which php/mysql uses to save data

MySQL throws an exception, PHP relays it to the user

The manual can. Please read it.

Wow… okay, you’re a bit off.

trunk has limited access

i searched the manual couldnt find it

mkdir() [function.mkdir]: Permission denied in …/config.php on line 92

Notice the message there… PHP message, not from MySQL.

I can find it. Perhaps you’re not searching hard enough.

I thought we were talking about MySQL.
My mistake.

You were misinformed then.

What’s the original problem again here?

Jafet can you give me the page i should be looking

No, not informed at all. I never read up, just went with the repeated references to a mysql user.

No pages matched your query

Now, back to the problem… to solve that error message, your *web* user that runs PHP needs write/execute access to the parent directory where you’re trying to make a directory.

ok

classname

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.