[PHP] Re: need help

2002-08-11 Thread B.C. Lance
to do a comparison between two values / variables, you have to use == instead of = = is an assignment while == is a comparison operator if($row['gid'] == 0) { $rat = 110; } elseif($row['gid'] == 1) { $rat = 9.5; } else { $rat = 6.6; } -- PHP General Mailing List (http://w

[PHP] Re: passing an array in a link

2002-08-11 Thread B.C. Lance
you could try this: transmitting end: $value) { $searchArg .= "keylist[]=".htmlentities($value)."&"; } ?> array from search argument receiving end: foreach($_GET["keylist"] as $key => $value) { echo "{$value}"; } David T-G wrote: > Hi, all -- > > I collect field keys in an array that

Re: [PHP] passing an array in a link

2002-08-11 Thread B.C. Lance
from my experience, you don't really have to worry much on the space issue. & is the delimiter to determine that the string terminates and a new argument begins next. and very often, the browser will do an auto conversion from space to %20 when you click on the link. David T-G wrote: > > so

Re: [PHP] Re: need help

2002-08-11 Thread B.C. Lance
ahhh. let the parser do the check. works great if you are not comparing with 2 variables :) in fact, another way to avoid this kinda pitfall, switch is another alternative. but of course, switch has its pitfall too. ;) Matt wrote: > if(0 == $row['gid']) > > > -- PHP General Mailing Li

[PHP] Re: Good Damn

2002-08-11 Thread B.C. Lance
you might wanna use this instead: $result = mysql; if (mysql_num_rows($result) { while } else { echo 'no articles'; } $result will always hold an int value if the query does not contain any error. so doing a num_rows on it will be more accurate in telling you if records are been

[PHP] Re: Cookie array

2002-08-11 Thread B.C. Lance
to store: setcookie ("TestCookie[0]", "zero", time() + 3600); setcookie ("TestCookie[1]", "one", time() + 3600); setcookie ("TestCookie[2]", "two", time() + 3600); or setcookie ("TestCookie[one]", "1", time() + 3600); setcookie ("TestCookie[two]", "2", time() + 3600); setcookie ("TestCookie[thr

[PHP] Re: Random mirrors and download quota

2002-08-11 Thread B.C. Lance
how about using the counter to store an id of the mirrors instead of randomly picking one? this will provide you a sequential traverse through all mirror sites. if there are 10 sites, the counter will always be from 0 -> 9. this way each mirror site will have equal share on hits. so if the cou

[PHP] Re: problem with array and session

2002-08-12 Thread B.C. Lance
try this instead: session_start(); . . . if (mysql_num_rows($_query)) { $_rec = mysql_fetch_array($_query); if (!isset($_SESSION["bkmks"]) || !in_array($_rec, $_SESSION["bkmks"]) { $_SESSION["bkmks"][] = $_rec; } else { echo "Already exist."; } } to test: echo

[PHP] Re: tricky preg_replace and how to escape the \{occurencenumber}

2002-08-16 Thread B.C. Lance
probably this will be faster? $fn = str_replace(".gif", "1.gif", $fn); Lallous wrote: > $fn = 'test.gif'; > > echo preg_replace('/(.+?)(\..+?)/', '\1a\2', $fn); > > ?> > > This script will output 'testa.gif' > > now how can i make it produce 'test1.gif' ? > > if i replace the: '\1a\2' with

[PHP] Re: tricky preg_replace and how to escape the \{occurencenumber}

2002-08-16 Thread B.C. Lance
and if you are gonna append '1' for all extension, try this: echo preg_replace('/(\..+?)/', '1$1', $fn); Lallous wrote: > $fn = 'test.gif'; > > echo preg_replace('/(.+?)(\..+?)/', '\1a\2', $fn); > > ?> > > This script will output 'testa.gif' > > now how can i make it produce 'test1.gif' ? >

[PHP] Re: tricky preg_replace and how to escape the \{occurencenumber}

2002-08-16 Thread B.C. Lance
hm... this should work, notice the double quotes echo preg_replace('/(.+?)(\..+?)/e', '"\1"."1"."\2"', $fn); Lallous wrote: > Oh well, > > I could have solved it w/ too many other methods, but how can I escape the > \{occurence} as in my case? > -- PHP General Mailing List (http://www.php.

[PHP] Re: checkbox question

2002-09-10 Thread B.C. Lance
if you can't use [] for the checkbox, the only way out is to have unique name for each checkbox. otherwise, php will always be returning the value of the last checked checkbox if all checkboxes share the same name without the []. --lance Alex Shi wrote: > How to ontain data from a group of ch

[PHP] Re: All Queries TRUE even when they should be FALSE

2002-09-20 Thread B.C. Lance
you should use mysql_num_rows() to check for records returned instead of using mysql_query(). this is because if $query is a valid $sql statement, mysql_query() will always return a resource link. which evaluates to true. so this will work for you: if (mysql_num_rows($result)) echo "record

[PHP] Re: Editor

2002-09-21 Thread B.C. Lance
http://www.phpedit.net Bryan McLemore wrote: > Hi guys, just wondering if anyone could recomend a good editor that is based on >windows. Thanks, Bryan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Copy & Paste URL was [Re: [PHP] Would appreciate thoughts on sessionmanagement ]

2002-11-11 Thread B.C. Lance
one reason that i could think of for not including session id into URL and using cookies would be copy & paste. users could just copy and paste the url and send it to his/her friends. and it could be a considerably number of people. imagine couple of people clicking on the link. that session wi

[PHP] page cannot be displayed after a post of form with over 80 post elements

2002-11-22 Thread B.C. Lance
hi guys, i am facing the above problem. i couldn't explain whats causing this behavior. however, those data does get posted to the server. only thing is that the result page is not showing up but the above error page. i have tested with 60+ post elements, but no error of such occur. any idea w

[PHP] fixed - Re: page cannot be displayed after a post of form with over80 post elements

2002-11-22 Thread B.C. Lance
managed to found out the cause. it was the cookies. it got overloaded with data and exceed the 4k limit. the cookies was storing preferences for too many users thus it break the limit. B.C. Lance wrote: hi guys, i am facing the above problem. i couldn't explain whats causing this beh

[PHP] does a form submit from a http page to a https ensure secure data?

2002-07-02 Thread B.C. Lance
it is sent via https specified in the [form] action? note: the registration form is served from http. could someone enlighten me on this? regards, b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] does a form submit from a http page to a https ensure securedata?

2002-07-02 Thread B.C. Lance
ces are accessing two different file system spaces >(or they should be unless you've got your server badly misconfigured) so >the http://...register.php is going to be a different file from the >https://...register.php. You might want to reconsider your design. > >..mike

Re: FW: [PHP] session problem

2002-07-06 Thread B.C. Lance
you might wanna check if register global is turned on or off. Naintara Jain wrote: > One thing I forgot to mention is that the same code works perfectly on the > web server (running on Apache and a Unix flavor). > > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROT

Re: [PHP] HTTPS vs. HTTP ? - the weakest link

2002-07-06 Thread B.C. Lance
safe? and not: http vs https just my 2 cents b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Thanks

2002-07-06 Thread B.C. Lance
not from meta refresh. but javascript could do that. set a timeout that will fire the submit event after 2 seconds. that will work. b.c. lance Alberto Serra wrote: > ðÒÉ×ÅÔ! > > Probably a stupid question. Is there anyway to force POSTing a form from > the refresh META? > &g

Re: [PHP] Thanks

2002-07-06 Thread B.C. Lance
you might wanna fire that javascript using onload from the body tag. that kinda assure the page is loaded successfully before the event takes off. Alberto Serra wrote: > I already have that and it works fine. The problem is when jscript is > not working (or missing). I was trying to build up s

Re: [PHP] Thanks

2002-07-06 Thread B.C. Lance
hm... how about sticking couple of iframes that will load the piece of javascript and have each of the javascript in the iframe firing at different time? i suppose at least 1 copy of javascript will be there to do the intended work. Alberto Serra wrote: > It is there already. My problem is to

Re: [PHP] Thanks -> Actually POSTING without javascript

2002-07-06 Thread B.C. Lance
le. use an image as the input type. that will probably brighten up the page. in short, what i mean is let the user do the submit if javascript fails. an image of brintney spear and a text on it telling the user to click on sounds appealing to you? ;) b.c. lance Alberto Serra wrote: > ðÒÉ×

[PHP] Re: Mailing all the elements of a form

2002-07-06 Thread B.C. Lance
you could loop through $_POST (assuming you are using a post action) to extract the value out. e.g. $arr = array_keys($_POST); for ($i = 0; $i < count($arr); $i++) { $msg.= "{$arr[$i]}: {$_POST[$arr[$i]]}\r\n"; } echo $msg; b.c. lance Jeremy Bowen wrote: > Hey, > >