[PHP] Re: Passing string variable to HTML TITLE tag fails within Netscape but works well within IE.
Have you considering putting the inside a Cheers, Owen Prime http://www.noggin.com.au Dwalker wrote: > Passing string variable to HTML TITLE tag fails within Netscape but work > well within IE. > > I have a single page consisting of inventory items to be sold. When an > item is selected, it passes the product name to a DETAIL page as part of > the TITLE tag for the DETAIL page. My problem is: Netscape does not like > the SPACES between the text and refuses to display the DETAIL page. > > Initially, I thought there might be some way to parse the string and add > the ascii code for SPACE, but I wasn't sure if I was on the right track. > Does anyone have a proven solution to this problem? > > I thought the pseudo code might look something like this: > function parse_and_change(&grab_string){ > $string_holder=$grab_string; > while stepping through the characters in this $string_holder { > if character = " " (or some other representation) > replace it with something that doesn't > scare netscape or title tag > } > return $string_holder; > } > ?> > > if (isset($HTTP_GET_VARS["itemname"])) { > $title = (parse_and_change($HTTP_GET_VARS["itemname"] )); > }else{ > $title="Generic Product Title"; > } > ?> > > > > > > > > > > > > THIS E-MAIL MESSAGE AND ALL ATTACHMENTS TRANSMITTED HEREWITH ARE TRADE > SECRET AND/OR CONFIDENTIAL INFORMATION INTENDED ONLY FOR THE VIEWING AND > USE OF ADDRESSEE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED > RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY REVIEW, USE, COMMUNICATION, > DISSEMINATION, DISTRIBUTION OR COPYING OF THIS COMMUNICATION IS > PROHIBITED. IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE > NOTIFY THE SENDER IMMEDIATELY BY TELEPHONE OR ELECTRONIC MAIL, AND DELETE > THIS MESSAGE AND > ALL COPIES AND BACKUPS THEREOF. THANK YOU FOR YOUR COOPERATION. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to user
Heres an example from the Variables from outside PHP section of the PHP docs. Warthog Guinness Stuttgarter Schwabenbräu So basically you need to add the [] to the name. So in this example your results will come back as an array: $beer = array("warthog", "guinness"); if you select the first two items. Cheers, Owen Prime http://www.noggin.com.au Khalid El-Kary wrote: > hi, > If i have a form that has a with multiple="ture" how would i be > able to retireve it's multiple values in the PHP script, i tried the > $_REQUEST['fieldname'] it gave me only the last selected value > > note: multiple selection is done by holding ctrl :) > > khalid > > > > _ > Unlimited Internet access -- and 2 months free! Try MSN. > http://resourcecenter.msn.com/access/plans/2monthsfree.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: upload directory
Just a thought from left field. Probably wont help much but if the clients side were willing to upload a zip file, you could decompress & expand it on the fly after uploading. Cheers, Owen Prime http://www.noggin.com.au Jennifer Swofford wrote: > Is there an easy way to upload an entire directory? Rather than selecting > the 19 files in a directory, to just select the directory, and have all > its contents go with it? (Or even a not-such-an easy way?) > > Thank you very much for any hints. > Jen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file_exists for URLs
Have a look at the fopen() function in the FileSystem Function section of the Docs. fopen() can open a file over http:// and I imagine it returns FALSE if it cant open it. If it doesn't return false, you could analyse the headers in $http_response_header. Hope this helps. Cheers, Owen Prime http://www.noggin.com.au Adrian Slusarczyk wrote: > Hi, > > I'm kinda new to PHP and have the following problem: In a function, I want > to verify whether a > file exists before I go on, and if it doesn´t, return false and stop right > there. So I tried > > if(!file_exists($my_file)) { > return false; > exit; > } > > But since $my_file is a URL, it doesn´t work. Does anybody know how to do > this so it works with URLs, i.e. w/o using file_exists() ? > > Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Launching a Browser Win with PHP - Is it possible?
Sorry, that should be window.opener.location.reload() instead of refresh(). Owen Prime wrote: > You will have to use mainly Javascript for this. What I have done in the > past is: > > STEP 1. > In the tag put a onSubmit argument which does a window.open(). This > should pop up a small window which you can use writeln() to add content to > it. Like your 'Uploading...' message or an image. > > STEP 2. > Also in the onSubmit argument, set this.target = the new window name. This > will make the form post to the popup window. > > STEP 3 > When the file is finished uploading, I get the PHP to output the > javascript: window.opener.refresh(); // Refreshes the main window > window.opener.focus(); // Brings the main window to the top > window.close(); // Closes the popup window. > > This should sort you out. > > Cheers, > > Owen Prime > http://www.noggin.com.au > > Monty wrote: > >> For a form that allows people to upload image files to the server, I'd >> like to pop open a small browser window with an "Uploading..." message >> once someone clicks on Submit button. Then I'd like the window to >> automatically close once the process is done and the main browser window >> refreshes. >> >> Can this be done with PHP or should I be using Javascript? If there are >> any examples of how to do this online, I'd appreciate the URL. >> >> Thanks! -- Cheers, Owen Prime http://www.noggin.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Launching a Browser Win with PHP - Is it possible?
You will have to use mainly Javascript for this. What I have done in the past is: STEP 1. In the tag put a onSubmit argument which does a window.open(). This should pop up a small window which you can use writeln() to add content to it. Like your 'Uploading...' message or an image. STEP 2. Also in the onSubmit argument, set this.target = the new window name. This will make the form post to the popup window. STEP 3 When the file is finished uploading, I get the PHP to output the javascript: window.opener.refresh(); // Refreshes the main window window.opener.focus(); // Brings the main window to the top window.close(); // Closes the popup window. This should sort you out. Cheers, Owen Prime http://www.noggin.com.au Monty wrote: > For a form that allows people to upload image files to the server, I'd > like to pop open a small browser window with an "Uploading..." message > once someone clicks on Submit button. Then I'd like the window to > automatically close once the process is done and the main browser window > refreshes. > > Can this be done with PHP or should I be using Javascript? If there are > any examples of how to do this online, I'd appreciate the URL. > > Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Odd Problem
If you showed us the SQL your trying to execute and the table schema you may get more helpful responses. Cheers, Owen Prime http://www.noggin.com.au Stephen wrote: > Hello, > > I'm running a script that inserts a form's contents into a MySQL table. > However, when I insert the contents, I get an error telling me this: > > Unknown column 'employee' in 'field list' > > I can't find the problem. I have a field in my table called employee but I > guess it doesn't see it. Any ideas why? > > Thanks, > Stephen Craton > http://www.melchior.us > http://php.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting GD version
Been there. The function still exists in GD < 2.0. Thats why it produces such a specific error message. Otherwise it would say function doesn't exist. Thanks for you input anyways. Cheers, Owen Prime http://www.noggin.com.au Andrew Brampton wrote: > try function_exists('imagecopyresampled'); > > otherwise I'm sure there has to be some function that returns versions of > libs. > > Andrew > - Original Message - > From: "Owen Prime" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, October 14, 2002 1:37 AM > Subject: [PHP] Detecting GD version > > >> Has anyone got any better ideas about how to detect what version of GD is >> running other than the following. The reason I ask is that I want to use >> imagecopyresampled() only if available ie. GD >= v2.0. >> >> OPTION 1. >> Parse phpinfo() output for the GD version info. Expensive. >> >> OPTION 2. >> Run imagecopyresampled() suppressing errors and then check the error msg. >> ie: >> @imagecopyresampled(); >> if ($php_errormsg != "imagecopyresampled(): requires GD 2.0 or later") >> // GD >= v2.0 >> } else { >> // GD < v2.0 >> } >> >> Option 2 is the best I can come up with at the moment luckily the >> "requires GD 2.0" error message is triggered before the argument > validation >> errors. >> >> Anyone got a better idea? >> >> Thanks, >> >> Owen Prime >> http://www.noggin.com.au >> >> -- >> 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] Detecting GD version
Has anyone got any better ideas about how to detect what version of GD is running other than the following. The reason I ask is that I want to use imagecopyresampled() only if available ie. GD >= v2.0. OPTION 1. Parse phpinfo() output for the GD version info. Expensive. OPTION 2. Run imagecopyresampled() suppressing errors and then check the error msg. ie: @imagecopyresampled(); if ($php_errormsg != "imagecopyresampled(): requires GD 2.0 or later") // GD >= v2.0 } else { // GD < v2.0 } Option 2 is the best I can come up with at the moment luckily the "requires GD 2.0" error message is triggered before the argument validation errors. Anyone got a better idea? Thanks, Owen Prime http://www.noggin.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: MySQL back up
Haven't really been following this thread but you may want to make sure that 1. mysqldump & gzip are executable by apache 2. $backupdir is writeable by apache 3. You have taken into consideration your php safe mode settings Cheers, Owen Prime http://www.noggin.com.au Ken wrote: > Okay here is the new code and this is still not working. > > > require("./config.php"); > > $sqlserver = $server1; > $sqlusername = $username1; > $sqlpassword = $password1; > $sqldatabase = $database1; > > //** > $nam_bak=date('D,d-m-Y'); > > exec("mysqldump -u\"$sqlusername\" -p\"$sqlpassword\" \"$sqldatabase\" > > $backupdir/$nam.sql"); > > exec("gzip $backupdir/$nam.sql"); > > ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extract HTML tags
If you can guarantee that your body tags are lowercase and have no args, then I would check out strtok() in the string functions. If your body tags are not that easy to match then I suggest you use either a regex or write a state machine to parse the string. A good html parsing state machine is in the php source for htmlstriptags. Note that Regex's are extremely expensive on large strings. Cheers, Owen Prime http://www.noggin.com.au Shawn McKenzie wrote: > I've loaded an html file into a string. What I'd like to do is create two > new strings: > > first new string with the original string but remove all content from the > beginning of the file up to and including , and then remove from the > end of file up to and including > > second new string only containing content after up to and including > > > Any ideas on simple ways to do this? > > TIA > -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: displaying a select number of rows from a sql query
With the line: while (list($link, $title, $content) = mysql_fetch_array($result)) { The php docs don't actually say what the list() function returns, but since your getting an infinite loop i would say that it probably evaluates to true no matter whats on the right hand side of the assignment. I would suggest that you use: while ($tmp = mysql_fetch_array($result)) { list($link, $title, $content) = $tmp; Cheers, Owen Prime http://www.noggin.com.au Keith Posehn wrote: > Ok, here is the question: > > I have a sql query, nothing special. It has 3 variables. I have created > the php code to display the variables in context with the html code. I > need it to loop a select number of times, most likely twice, and therefore > display the first two rows of the query. > > In other words, querying the database for a set of rows, it needs to > display the first two of the rows on the page. > > Here is the code I have tried so far, which has either looped continuosly > or displayed the top row twice (edited for security): > > > > $sql = "SELECT * FROM [database] ORDER BY [collumn] LIMIT 2"; > $result = mysql_query($sql) or die("problem with $sql"); > // list($title) = mysql_fetch_array($result); > ?> > > > > What's New? > > > /* It tried this: */ while(list($link, $title, $content) = > mysql_fetch_array($result)){ > > /* And this: */ while($row = mysql_fetch_array($result) and > (($count++)<2)){ > > // The first kept looping infinitely, the second displayed the top row > twice. Grr... >_< > > ?> > > > "> mysql_result($result,0,"title"); ?> > > > > > > } > ?> > > > > Thanks for any help you can provide. > > -Keith Posehn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image problem
If the browser still doesn't listen, you can always put a time() arg in you img src. ie. "" David Erickson wrote: > I had a similar problem and I just put this in front of my php so > everytime my scripts are called they always tell the browser and any proxy > servers not to cache anything from me. > > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");// Date in the past > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); > // always modified > header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 > header("Cache-Control: post-check=0, pre-check=0", false); > header("Pragma: no-cache"); // HTTP/1.0 > > > - Original Message - > From: "Donahue Ben" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, October 09, 2002 1:00 PM > Subject: [PHP] Image problem > > >> I upload an image. Once I upload this image using the >> is_uploaded_file function, then writing this image >> file using the copy function. Everything seems to >> work fine. When i try to update (that is uploading a >> new file and saving it with the same name as the first >> file created) it shows the first image instead of the >> second image. So what I did was closed my browser, >> then reopened it, then everything was ok. So I figure >> that I have a cache problem. I then tried using the >> clearstatcache() function right after I update this >> image file. But it did not seem to work. So am I >> going to have to close and reopen my browser to see >> these changes take place or is there something else I >> can do? >> >> Ben >> >> __ >> Do you Yahoo!? >> Faith Hill - Exclusive Performances, Videos & More >> http://faith.yahoo.com >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> -- Cheers, Owen Prime http://www.noggin.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Speeding up a Mysql Select
Have a look into indexes I'm running selects on tables with about 4.5 million rows on a desktop without problems. Bob Irwin wrote: > G'day, > > I'm doing a select on a database that has about 45000 records and growing > and its a bit SLOW. > > Its using a unix timestand to mark the beginning of a call and the end of > a > call. This is also used so I know what date the call was received. > > When I do a > > select * from support where begintime between 'timestamp1' and > 'timestamp2'; > > It takes a while to execute... The timestamp fieldtype is varchar(10)... > Will I see any speed difference with a different column type? > > Any advice on how to speed this up would be greatly appreciated! :) > > Best Regards > Bob Irwin > Server Admin & Web Programmer > Planet Netcom -- Cheers, Owen Prime http://www.noggin.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTML and text email
My advice would be to set your mail program's preferences to send messages in text & html (you can do it in NS or Moz), send yourself a message with a link or bold or something to make it an html message, then view the source. Cheers, Owen Prime http://www.noggin.com.au Chris Cook wrote: > Hello all, > > I am trying to send out a multi-part email that is both text and HTML. The > HTML is so I can embed links into the email. However, some of my clients > have text-only email programs and all the HTML tags are visible. Is there > a way that I can display HTML in the HTML enabled programs and text in the > text-only email programs? > > This is the header that I currently use. > > $headers = "MIME-Version: 1.0\r\n"; > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > > Thanks for any help, > Chris > > > _ > Join the worlds largest e-mail service with MSN Hotmail. > http://www.hotmail.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP to Excel (csv)
Check out http://www.wotsit.org for the exact csv specifications but here is a snippit that works for me: function csv($value) { if (strstr($value, ",") || strstr($value, "\n") || strstr($value, "\r")) { return "\"" . str_replace("\"", "\"\"", $value) . "\""; } else { return $value; } } Run this function on each value then implode them with a comma and put a \n at the end. Cheers, Owen Prime http://www.noggin.com.au Ivo Stoykov wrote: > Hi > > I have following problem. > > Some data retreived from mysql db I need to send to the user as a *.csv > file. Usually I separate fields (usually double quoted) with comma (,) or > semicolomn (;) and the records with cr/lf (Windows) > It works fin until I do not have cr/lf in any of the fields. > > Unfortunately the last field is TEXT type and may have more that one cr/lf > inside (as data). When this is the case the *,csv file cannot be open > correctly in Excel. If there are cr/lf in any field it is split in Excel > as a separate row and the record structure is broken.\ > > Any idea how could solve this? Thank you > > Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there an alternative to this code?
Good answer. I tend to put the following line in my css which gets rid of this problem in pretty much all browsers. FORM { vspace: 0px; hspace: 0px; } Cheers, Owen Prime http://www.noggin.com.au @ Edwin wrote: > Yes, I agree, this is an html/css question... but you can try this. > > Instead of putting your tags inside the tags, why not > put them outside the tags like this: > > > > > > > > > > I think this won't destroy the "alignment". > > Just an idea... > > - E > > On Tuesday, October 8, 2002 11:24 AM > Subject: Re: [PHP] is there an alternative to this code? > Justin French wrote: > >> Alignment of elements in a table or form is really a HTML/CSS question. >> Just to make matters worse, I have problems with aligning in IE, but not >> NN... so perhaps there is no way to get it all working... try a HTML or > CSS >> group. >> >> Instead of a form, you could just have a clickable image, with any vars > you >> need in GET, not POST: >> >> myvar=myvalue"> >> >> or perhaps what you want in your case is: >> >> CS= Customer Service">> border="0"> >> >> >> >> Depends what you want to achieve on the next page. >> >> >> Justin French >> >> >> >> >> on 08/10/02 11:13 AM, Jeff Bluemel ([EMAIL PROTECTED]) wrote: >> >> > I would like to do this without using a form... is there a way I can > recode >> > this? >> > >> > I have the following table... the button that originates from a form >> > is > out >> > of alighnment, and sits higher then the rest. how do I solve this? >> > >> > > > border="0"> >> > >> > > > $QUERY_STRING;}?>" method="POST"> >> > > > name="CS" > >> > >> > >> > >> > >> > >> > > > src="images/logoff-bttn.jpg" border="0"> >> > >> > -- >> > Jeff Bluemel >> > >> > >> > >> > -- >> > Jeff Bluemel >> > office (307) 787-6962 >> > cell (307) 780-6962 >> > fax (307) 787-6963 >> > >> > >> >> >> -- >> 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] Re: is there an alternative to this code?
You may have already been here but what about a border="0" and align="absmiddle" on the image button. Cheers, Owen Prime http://www.noggin.com.au Jeff Bluemel wrote: > I would like to do this without using a form... is there a way I can > recode this? > > I have the following table... the button that originates from a form is > out > of alighnment, and sits higher then the rest. how do I solve this? > >border="0"> > > $QUERY_STRING;}?>" method="POST"> > name="CS" > > > > > > >border="0"> > > -- > Jeff Bluemel > > > > -- > Jeff Bluemel > office (307) 787-6962 > cell (307) 780-6962 > fax (307) 787-6963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Division by zero
Make sure that vote1, vote2, and vote3 are not null. Maybe you need to use the IFNULL(vote1, 0) function. Cheers, Owen. Gary wrote: > I am trying t get the percent of votes form the table poll, but keep > getting Division by zero for the line commented below. > > > if ($res) { > echo "bla bla bla"; > $sql = "SELECT question, responce1, responce2, responce3, > vote1, vote2, vote3, date FROM poll WHERE id = {$_POST['id']}"; > $res = $db->query($sql); > if (DB::isError($res)) { > die ($res->getMessage()); > } > while ($row = $res->fetchRow()); > $id = $row[0]; > $question = $row[1]; > $responce1 = $row[2]; > $responce2 = $row[3]; > $responce3 = $row[4]; > $vote1 = $row[5]; > $vote2 = $row[6]; > $vote3 = $row[7]; > $date = $row[8]; > > /* Count the votes*/ > $total = $vote1 + $vote2 + $vote3; > > /* Caluclate */ > $perc_vote1 = round(($vote1/$total)*100,2); /* Division by zero*/ > $perc_vote2 = round(($vote2/$total)*100,2); /* Division by zero*/ > $perc_vote3 = round(($vote3/$total)*100,2); /* Division by zero*/ > > > > > TIA > Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php