RE: [PHP] Whats wrong with my code?
no semicolon after "include ($include)" hope that helps, Craig -Original Message- From: Stevie D Peele [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Whats wrong with my code? Can someone spot what Is wrong with my code? It says Line 195 which is the ?> Would it matter I don't have all of these files (i.e. /includes/world.html) were uploaded yet? Thanks, Stevie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Feeling a bit brain dead, please help in maths: averages
off the top of my head: SELECT AVG(age), SUM(salTotal) FROM blah WHERE section = 3 i'm not sure if you can use the 2 functions in the same query, you might have to break it into 2 queries. Craig -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 3:08 PM To: [EMAIL PROTECTED] Subject: [PHP] Feeling a bit brain dead, please help in maths: averages Hey, Been working a bit too much i guess so am feeling braindead... I have a couple of records in the database, i am doing a: "select age,salTotal from blah where section=3" this is getting me a list of records, how do i calculate the average age and salary total (salTotal) to display in my php page? Cheers, -Ryan A We will slaughter you all! - The Iraqi (Dis)information ministers site http://MrSahaf.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Feeling a bit brain dead, please help in maths: averages
> -Original Message- > From: Ryan A [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 17, 2003 3:21 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] Feeling a bit brain dead, please help in maths: > averages > > > Hey, > Thanks for replying. > > Actually I made that example simple, i actually need the average > of 7 to 9 > fieldsand i dont want to run 7 selects :-( > I know its been done on elancebut how? > > Thanks, > -Ryan this should do the trick... but it's not tested ;) #assuming you are using mysql and your query #has successfully executed and your results #are in $resultSet $rowCount = 0; $ageSum = 0; $salarySum = 0; #use as many sums as needed while ($row = mysql_fetch_object($resultSet)) { $ageSum += $row->age; $salarySum += $row->sal; $rowCount++; } $salaryAvg = $ageSum / $rowCount; > > > > off the top of my head: > > > > SELECT AVG(age), SUM(salTotal) > > FROM blah > > WHERE section = 3 > > > > i'm not sure if you can use the 2 functions in the same query, > > you might have to break it into 2 queries. > > > > Craig > > > > -Original Message- > > From: Ryan A [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, September 17, 2003 3:08 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Feeling a bit brain dead, please help in maths: averages > > > > > > Hey, > > Been working a bit too much i guess so am feeling braindead... > > > > I have a couple of records in the database, i am doing a: "select > > age,salTotal from blah where section=3" > > this is getting me a list of records, how do i calculate the average age > and > > salary total (salTotal) to display in my php page? > > > > Cheers, > > -Ryan A > > > > > > > > > > > > > > > > We will slaughter you all! - The Iraqi (Dis)information ministers site > > http://MrSahaf.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Flash Chat
> -Original Message- > From: Dan J. Rychlik [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 18, 2003 12:22 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Flash Chat > > > Hello, > > I was wondering if my solution would work in theory in providing > a Flash chat application. > > I would use the AMFPHP to interface with the flash object. I > would use a class to describe the chat room and creat new objects > for private rooms. Do you think that this will truly work, In > theory I mean. > > Has anyone accomplished this before? > > -Dan not a chat app, but www.chefs-hat.com has an all flash front-end, and php doing all of the backend db work. it is pretty straightforward to get flash and php working together. have fun, Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with treeview
This should get you started... http://www.sitepoint.com/article/1105/1 it is a great article assuming that you will be using a db to store your data. hth, Craig -Original Message- From: Stephen [mailto:[EMAIL PROTECTED] Sent: October 1, 2003 11:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Help with treeview Does anyone know how to implement a treeview style display in PHP? Thanks, Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] why does this script mysteriously die?
Hi All, I have a script that takes a directory of user uploaded files and resizes them to the required sizes. I was given ~750 test pix to run through, and my solution only sorta works. The problem is that it won't get through the whole batch without dying. It will process anywhere between 13 to 350 pix in one go before stoping, and it takes 3 or 4 tries to get it restarted. I have set_time_limit(0); in the code, so it isn't timing out. I can't even think what else it could be, so any help is greatly appreciated. thanks in advance, Craig if ($HTTP_GET_VARS['resize'] == 'resize') { $fixedCount = 0; foreach ($picList as $pic) { $picPath = '../uploads/jpegPics/' . $pic; $smallDest = '../images/products/thumbs/' . $pic; $midDest = '../images/products/normal/' . $pic; $bigDest = '../images/products/big/' . $pic; if (filesize($picPath) > 200) { unlink($picPath); echo "==>PROBLEM: $pic is more than 2 Mb and has not been resized"; } else { $big = resizeImageJPG(450, 450, $picPath, $bigDest, 1); $mid = resizeImageJPG(204, 204, $picPath, $midDest, 1); $thumb = resizeImageJPG(70, 70, $picPath, $smallDest, 1); if ($thumb && $mid && $big) { echo "$pic has been resized"; $fixedCount++; unlink($picPath); flush(); } else { if ($pic=='noPix'||$pic=='thumbs'||$pic=='normal'||$pic=='big') { //won't show error when directories aren't resized } else { echo "==>PROBLEM: resize of $pic failed."; } } } } echo "$fixedCount files have been successfully resized"; } function resizeImageJPG($forcedwidth, $forcedheight, $sourcefile, $destfile, $imgqual) { $g_imgcomp=100-$imgqual; $g_srcfile=$sourcefile; $g_dstfile=$destfile; $g_fw=$forcedwidth; $g_fh=$forcedheight; if(file_exists($g_srcfile)) { $g_is=getimagesize($g_srcfile); if(($g_is[0]-$g_fw)>=($g_is[1]-$g_fh)) { $g_iw=$g_fw; $g_ih=($g_fw/$g_is[0])*$g_is[1]; } else { $g_ih=$g_fh; $g_iw=($g_ih/$g_is[1])*$g_is[0]; } $img_src=imagecreatefromjpeg($g_srcfile); $img_dst=imagecreatetruecolor($g_iw,$g_ih); $imgCpRES=imagecopyresampled($img_dst,$img_src,0,0,0,0,$g_iw,$g_ih,$g_is[0], $g_is[1]); $imgJPEG=imagejpeg($img_dst, $g_dstfile, $g_imgcomp); imagedestroy($img_dst); if ($imgJPEG) { return true; } else{ return false; } } }// end function resizeImageJPG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why does this script mysteriously die?
it's not a time limit or safe mode issue, the script is currently running, and has been for about 10 minutes. it's not a fast script =( Craig >Is safe mode on? > >Craig Lonsbury wrote: >> Hi All, >> I have a script that takes a directory of user uploaded files >> and resizes them to the required sizes. I was given ~750 test >> pix to run through, and my solution only sorta works. The problem >> is that it won't get through the whole batch without dying. It >> will process anywhere between 13 to 350 pix in one go before >> stoping, and it takes 3 or 4 tries to get it restarted. >> >> I have set_time_limit(0); in the code, so it isn't timing out. >> I can't even think what else it could be, so any help is >> greatly appreciated. >> >> thanks in advance, >> Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Credit Card Validation
this is a good explanation of the validation you can do. http://www.beachnet.com/~hstiles/cardtype.html if you are trying to validate client-side you'll need javascript, which is why there may not be anything on phpbuilder i have no idea about the bank side, but post any info you find out back here, it is coming up soon for me =) hth, Craig -Original Message- From: Nathan Taylor [mailto:[EMAIL PROTECTED] Sent: October 8, 2003 2:04 PM To: php-general Subject: [PHP] Credit Card Validation Hey guys (and gals), I am sure this has been asked many times before, but I couldn't seem to find a recent PHP4-based thread in the logs at phpbuilder.com; so either I'm incompetent or it doesn't exist. My question is pretty obvious, I was wondering what the process for validating a credit cards with both preprocessing by the form to determine the pattern validity and post processing by a bank to confirm the actual card validity. Your help would be greatly appreciated. Best Wishes, Nathan Taylor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] nested require_once
Hi All, I just wanted to confirm that require_once works as I think it should, but the manual isn't too clear about nesting scripts (or i'm just thick =). What I think is/should be happening is that dbLib.ink is only included in index.php once, but when I run helperLib.php on its own, it has dbLib.php. In index.php, i have require_once("includes/outputLib.php"); require_once("includes/dbLib.php"); require_once("includes/helperLib.php"); and then within helperLib.php, i have require_once("dbLib.php"); I know this seems to be exactly what the whole 'once' part is about, but better safe than sorry. thank you, Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How can i print out the files in a directory?
This has been working for me... just pass the function the path to the directory you want the listing for. function getDirFiles($dirPath){ if ($handle = opendir($dirPath)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $filesArr[] = trim($file); } } closedir($handle); } return $filesArr; } hth, Craig -Original Message- From: Bas [mailto:[EMAIL PROTECTED] Sent: October 17, 2003 6:42 AM To: [EMAIL PROTECTED] Subject: [PHP] How can i print out the files in a directory? How can i print out all of the files in a directory? I want some output as this: index.php login.php image1.gif image2.jpg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dictionary
are you using windows or *nix? There is a good dictionary (I think it is called dict) built into most *nix distros,and have yet to find a good dictionary for windows. maybe someone else knows a good one =) Craig > -Original Message- > From: pete M [mailto:[EMAIL PROTECTED] > Sent: November 5, 2003 8:40 AM > To: [EMAIL PROTECTED] > Subject: [PHP] dictionary > > > Got a bit of a peculiar problem. > > I'm recovering a hard disk which has got corrupted (work for a data > recovery business). > > I've got a whole stack of text files which I need to clean up > to try and > get back some of the text information > here's an example snippet > > > YuR(I\aQMKNXe17lq~Pr?Xhb^~{ikiF..CIC1( }vNHDfQkT%B3R|*ADt?'6T+?k%,^N{ > "2wjObU=/[EMAIL PROTECTED]@WG8.AH9Y6IZ rldhBi(bTAAXAoB%}%&l > [EMAIL PROTECTED])[EMAIL PROTECTED]&Ol4~Y// > /7;{;e$zwv?xj)(8kkOg(61&[EMAIL PROTECTED]>` p< [EMAIL PROTECTED]'FCWL[w)fwe#5B^C`$P"lW > rc&GSrVL _DlVM7KNnvOmp= > Jk3]cqXR]{Qp;Y23`GPDjnP,Y6>M}z`7N s:x3)GP;uFreD]N3GQQbb+X`kN[Product0] > LANGUAGE=English > MONIKER={DE907F20-A4A0-11d2-A985-00104B70545A} > PRODUCT=LiveUpdate > PRODUCTNAME=LiveUpdate > > The way I'm processing is by reading eacho file line by line, keeping > all charachters ascii >=32 <= 127 > > What I want is a dictinary of some sort to try and eliminate > the lines > where and english word does not exist !! > > Anyone got any ideas ... greatly appreciated > > pete > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: High bandwidth application tips
another small tweak is to limit or remove html comments. this doesn't directly speed up code, but makes for less strain on your outbound pipe (good for you) and smaller downloads for the users (think dial-up). i usually try to put my comments in the php code. this reduces the bytes sent, maintains code readablity, and doesn't adversely affect script execution time. Craig > -Original Message- > From: felix zaslavskiy [mailto:[EMAIL PROTECTED] > Sent: November 5, 2003 8:35 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: High bandwidth application tips > > > Take a look here: > http://phplens.com/lens/php-book/optimizing-debugging-php.php > > I also recommend X-debug extention for profiling. > > > On Wed, 5 Nov 2003 13:36:01 -0600 > [EMAIL PROTECTED] (Luis Lebron) wrote: > > > I have been coding php for a few years now, but I haven't > build a "high > > bandwidth" application. I am currently working on an > application for a > > customer that may have a very large amount of users (10,000 or more > > according to the customer). Are there any good reference > books, articles > > and general information on building such a site. I have > been "googling" for > > a while but have found anything on this particular topic. > > > > thanks, > > > > Luis R. Lebron > > Sigmatech, Inc > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP]{so far OT it boggles} BTML 2.0 released!!!
> > Personally, these emails don't help me at all in my search > for help, or > helping people with php problems. Could I suggest that you guys maybe > put a forum up for anybody who wants to bitch about this > topic? OR maybe > someone could setup a php-arguments list for topics such as these! > I couldn't agree more. Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php