Re: [PHP] Re: escaping PHP's closing tags
On Wednesday, March 27, 2002, at 12:03 PM, Julio Nobrega Trabalhando wrote: Haven't seen it either, but you could use: echo '' . '?'; So is separated from ?. Or ? from for the matter. That's a good workaround. I'll use that until I hear from above. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query bug
On Wednesday, March 27, 2002, at 04:00 PM, Daniel Ferreira Castro wrote: I want to select the fields nome,id_proj,arquivo FROM ALGORITMO and ATAS. But when I use the query below, I receive the error ERROR 1052: Column: 'nome' in field list is ambiguous. What is wrong on my query? query: SELECT nome,id_proj,arquivo FROM ALGORITMO,ATAS WHERE id_proj=0 AND eng=1 OR nome=teste OR nome=de OR nome=parse; Daniel, try specifying which table you want the 'nome' column to be used in -- the ambiguous part is that many of the tables you are selecting FROM have a 'nome' column. Do it like this: SELECT ALGORITMO.nome, ALGORITMO.id_proj, ATAS.arquivo FROM ALGORITMO, ATAS WHERE ALGORITMO.id_proj=0 ANDALGORITMO.eng=1 OR ALGORITMO.nome=teste OR ATAS.nome=de OR ATAS.nome=parse; Obviously, I have no idea how you want your query to look, so be sure to customize it for your needs, but this demonstrates what you need to do: Explicitly state the table whose column you want to access. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] while loop: detect next loop?
On Wednesday, March 27, 2002, at 04:11 PM, Matt Friedman wrote: When you have all your items in an array use implode to add a character in between every item. $str = implode($yourArray, $separator); This will add the separator to the end of each string except the last one. I like that idea, but I don't think it would work in this case -- for one thing, the array is a pointer to a mysql_fetch_assoc() result, so I am not sure how to implode that (not saying it can't be done), and for another, I would have to explode the array again and would lose the separator. Unless... unless I were to implode with say, a bogus separator AND a 'real' separator, and then explode using only the bogus separator (leaving the 'real' separator hanging onto the end of each element). This seems like it could work, but in a complex array like a mysql_fetch_assoc() result, I'm not sure how to implode. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query bug
On Wednesday, March 27, 2002, at 04:28 PM, Daniel Ferreira Castro wrote: This way works, but not the way i would like to. Because it selects just the fields nome,id_proj and arquivo from the table ALGORITMO, and here my goal is to select those fileds of ALGORITMO and ATAS. Then why not just add an additional lines? SELECT ALGORITMO.nome, ALGORITMO.id_proj, ALGORITMO.arquivo, ATAS.nome, ATAS.id_proj, ATAS.arquivo FROM ALGORITMO, ATAS WHERE ALGORITMO.id_proj=0 ANDALGORITMO.eng=1 OR ALGORITMO.nome=teste OR ATAS.nome=de OR ATAS.nome=parse; OR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using a counter in a foreach loop
I have a pretty basic question and was wondering if someone could point me in the right direction: I have a foreach loop, where I execute some commands for each element in a certain array. One thing I would like to add to this loop is a counter, so that on each iteration of the loop I have a next higher number. The following does not work: foreach ($months) { $i = 1; // do some things $i++; } because in each new iteration of the loop, $i is reset to 1. Is there a way that I can achieve this effect? Thanks for any advice, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using a counter in a foreach loop
What an embarrassing oversight. I'm sorry, I figured this one out. You don't define the $i counter variable in the loop (DUH). $i = 1; foreach ($months) { // do some things $i++; } Thanks to all those who may respond before reading this Erik On Tuesday, March 26, 2002, at 09:49 AM, Erik Price wrote: I have a pretty basic question and was wondering if someone could point me in the right direction: I have a foreach loop, where I execute some commands for each element in a certain array. One thing I would like to add to this loop is a counter, so that on each iteration of the loop I have a next higher number. The following does not work: foreach ($months) { $i = 1; // do some things $i++; } because in each new iteration of the loop, $i is reset to 1. Is there a way that I can achieve this effect? Thanks for any advice, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] OT - number of chars in querystring
Sorry for this quick OT question -- I'm skimming thru the HTTP spec but can't find anything that defines the character limit in GET requests. I'm writing a form that uses GET to send data to my PHP script, but I'm afraid that if the user enters too many characters then some will get cut off. Does anyone know the actual limit? If not, is there a generally-accepted maximum that is used (to assure compatibility with most user agents and servers)? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookie problem. Not possible to set and read a cookie on the same page?
On Tuesday, March 26, 2002, at 11:42 AM, Miguel Cruz wrote: There is no chance for the server to re-read the cookies from the browser after step 2 above, unless, as you've observed, you refresh the page, which in effect just repeats both steps. One ugly way that I've gotten around this in one of my scripts was to set the cookie, and then use header(location: samepage.php) to refresh the page -- worked fine, and if all you do is set the cookie before calling header() it should be practically unnoticeable. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which php book 2 buy ?
On Tuesday, March 26, 2002, at 11:57 AM, Tony Crockford wrote: MySQL/PHP Database applications by Greenspan and Bulger ISBN 0764535374 Good book. Also has a 40 page chapter on how to build a shopping cart complete with design rationale and working code (on CD) I thought this would have been a great book if it weren't for the numerous errors in the code sections. I highly recommend it if you know PHP well enough to bang out a few forms and if you know MySQL well enough to write some INSERT and SELECT statements -- if this is the case then you will have no problem noticing the errors, and can use the book as a guide to writing complex web applications. In my case, though, I started learning PHP with this book, and the frustration with code errors drove me to return it to the store. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - number of chars in querystring
On Tuesday, March 26, 2002, at 11:47 AM, Darren Gamble wrote: It appears that you might be submitting a lot of data. If that's the case, you should really have your application determine the information to be submitted and then store/create them as hidden values in a form. That way, not only will you have no problems with length, but you don't have to worry about the client caching it. I wanted to use GET rather than POST method so that users could bookmark the results of the form -- it is essentially a search engine for a MySQL database. The form has built-in limits to how long the inputs can be, and in fact most of the inputs are really select listboxes and not text-style inputs, so I'm not really worried about having TOO many characters -- but it could get over 255, which is exactly the number that I thought I had read was a maximum. Thanks for the reply, Darren. 2048 seems like a workable limit to me. But I'm curious about your suggestion -- how would I get the user inputted data into hidden form variables without submitting the form in the first place? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array in a Loop Question
On Tuesday, March 26, 2002, at 01:18 PM, Jeff Hatcher wrote: I have a form that gets repeated depending on number of members in a group(1 form surrounds all members). I separate the entries by assigning a count value to the names of the inputs (Ex. input type=text name=address$count value=). Does anyone know how I can pull the values back out of the $_POST[]? Example of ideal scenario that does not work: case process1: for ($i=0;$i$_POST[count];$i++) { $_POST[address$i] } The initial form: for ($i = 1; $i = $_POST['count']; $i++) { print input name=\address{$i}\ type=\text\ /\n; } print input name=\count\ type=\hidden\ value=\ . $_POST['count'] . \ / What the above loop does is it makes a number of address inputs equal to $count... if $count is equal to 3, then you will get input name=address1 type=text / input name=address2 type=text / input name=address3 type=text / input name=count type=hidden value=3 / I changed your $i from 0 to 1 because it makes it mentally easier to work with (for me at least). Now in your next script, which is the target of the form, here is what you want to have: for ($i = 1; $i = $_POST['count']; $i++) { // do some code with $_POST[address{$i}], such as // entering it into a database or echoing it to the user in HTML } Some further notes -- the hidden form field was so that you could give the second script the count variable, so it knows how many loops to do (this value is otherwise not available to the second script). Also, the use of doublequotes in the second script ($_POST[address{$i}]) is imperative because with singlequotes the variable $i will not expand to $_POST[address2] or whatever. HTH, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT Re: [PHP] Re: which php book 2 buy ?
Totally off topic -- I thought that O'Reilly had switched to using a white binding with black text on all of their newly-[re]printed books. The picture of the sleeping babe with the book shows an older style, with a colored field (green) and white text. Maybe this is a localization thing. On Tuesday, March 26, 2002, at 01:51 PM, Rasmus Lerdorf wrote: Or, of course, if you want to be cool like Carl: http://lerdorf.com/buy/ ;) Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array in a Loop Question
On Tuesday, March 26, 2002, at 02:12 PM, Jeff Hatcher wrote: So my question is how can I put this in the database without having to reassign my variable name? You have to jump out of the quoted string that represents your SQL query when you echo the value of the $_POST variable. Like this: $sql = SELECT a FROM b WHERE c=' . $_POST['d'] . '; Note that I 'jumped out' immediately after the singlequote mark (which you need if your value is going into a string field) by closing the double-quoted string, using the dot to append the value of the variable $_POST['d'], and then using a dot to append another double-quoted string (which contains nothing but a single quote in it). Sometimes, depending on what your variable names look like, you can just escape your variable by using braces ('{' and '}'), but I think it's just easier to use the dot do appending from string to variable value to string again. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Session]
On Tuesday, March 26, 2002, at 02:14 PM, Evan wrote: Hi !! I can't make this work: PAGE 1: ? $HTTP_SESSION_VARS[v_s]=500; ? I am probably wrong about this, but I thought that you could register session variables using this technique only if you are using PHP 4.1.x and you use the format: $_SESSION['v_s'] = 500; Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Session]
On Tuesday, March 26, 2002, at 02:42 PM, Evan wrote: I have PHP 4.1.2 (the latest, I downloaded it a week ago). The manual says that: * If track_vars is enabled and register_globals is disabled, only members of the global associative array $HTTP_SESSION_VARS can be registered as session variables. The restored session variables will only be available in the array $HTTP_SESSION_VARS. * I won't use $_SESSION cause it seems that is a bit buggy have a search with google-user group $_SESSION. Okay, suit yourself -- but a reminder that $_SESSION is the 'official' method of referring to the SESSION array, and that $HTTP_SESSION_VARS has been deprecated and may not be available in a later release of PHP, thus rendering your code obsolete if you should ever upgrade. Read it for yourself, http://www.php.net/manual/en/language.variables.predefined.php Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why using this? When....
On Monday, March 25, 2002, at 09:31 AM, ...::: Rober2.com :::... wrote: What's really the meaning with whatever.php?page=1 when you are NOT using a db? Just cuz it looks cool? Or is there a better reason? -Cuz you could do a href=whatever.htm instead of blabla.php?page=1 (having include('blabla.htm'); in a script in blabla.php...of course) You can pass $_GET variables in this way, which become available on the next page. Here's an example: http://domain.com/whatever.php?theme=metallic Now in the whatever.php script, if there is code like this: // determine user's theme preferences print link rel=\stylesheet\ type=\text/css\ href=\; if ($_GET['theme']) { switch $_GET['theme'] { case 'sky': print 'sky.css'; case 'metallic': print 'metallic.css'; default: print 'standard.css'; } } else { print 'standard.css'; } print \ /; // finish the link tag Obviously, you wouldn't really use a theme in this fashion since you'd have to replicate this value in every link in your document -- this kind of thing is more appropriate to have in a session variable. But the lesson is the same -- variables can be passed in this fashion for any purpose, not just database access. (It's called passing a variable in the querystring.) HTH, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why using this? When....
On Monday, March 25, 2002, at 09:49 AM, ...::: Rober2.com :::... wrote: Ok, I get it. Exepet passing information there isn't other meaning right? Hm? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP, Sockets, and CRLF
The standard way to end lines when communicating via HTTP is the CRLF (ASCII 13 ASCII 10). But I write my PHP scripts using only LF (ASCII 10) for line endings. Why am I still able to write instructions to a socket -- does PHP automatically translate my line endings to CRLF, or is HTTP just flexible like that? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo Informative Text will Script Runs - how ?
On Monday, March 25, 2002, at 10:39 AM, Chris wrote: How can I echo some text such as Processing, please wait... whilst the PHP script runs. Rather than displaying a blank screen with the results being echoed once the script has fully completed. A hackish and inelegant way to do it would be to use JavaScript to create a new front window upon unLoad of the page that calls the PHP script. While the PHP script executes in the back page, taking its time to do its thing, the front page (perhaps a small window or something with an animated GIF to simulate the page loading effect) sits in front. When the PHP page has finally loaded, a new JavaScript command to close the page loading window executes, or you could have it close automatically after a certain number of seconds. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_REFERER
On Monday, March 25, 2002, at 02:52 PM, tom hilton wrote: This is working fine for most users, but one user is telling me that even though she is following the link from the index page, she's still getting the error message, and are being bounced back to the index page. She is using Internet Explorer 6.0. Are there any security or privacy settings that might restrict use of the $HTTP_REFERER variable? Or is there a better way to make sure users follow links to pages, rather than bookmarking and going straight to a page? Thanks for any help you can give me. I'm not sure about Internet Explorer 6's use of HTTP headers, but the referer header in the HTTP protocol is not required by any user agent. Legally, IE6 can choose not to send it, and still be in complete compliance with HTTP. There may not be an easy way to do what you want. One possible solution is to make the typical calls itself PHP page and display certain content based on certain variables being present, and use POST variables so that they do not appear in the URL. The problem with this is that it requires a ton of code to wrap your content in the 'protective' index.html layer, and also you would have to use form buttons rather than hyperlinks (unless you used post_to_host(), see archives if you're not sure what I mean). Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trap CR or Enter possible?
On Friday, March 22, 2002, at 12:11 AM, Jason Wong wrote: But, what are the undesirable effects of just pressing enter? I know that in IE pressing enter to submit a form is not the same as clicking on the submit button. If that is what you are referring to then it's very easy to code around that and thus would not require javascript. I have noticed that pressing enter in IE does achieve the same effect as pressing the submit button for my forms. But I have also heard that it's not really the same, especially if there are more than one submit-style inputs for the given form. What does Enter really do in IE? Side note to the original poster: in the script that is the target of the form you are writing, you may be able to test for the presence of the submit variable -- if this value is not present, then the user has not clicked the Submit button. I know that the value of a submit input is usually just used to label the button in some way (such as value=Click Here for Free Porn!), but you can actually test for this value if you have given the Submit input a name. I may be wrong about this, though. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trap CR or Enter possible?
On Friday, March 22, 2002, at 12:29 PM, Jason Wong wrote: Side note to the original poster: in the script that is the target of the form you are writing, you may be able to test for the presence of the submit variable -- if this value is not present, then the user has not clicked the Submit button. I know that the value of a submit input is usually just used to label the button in some way (such as value=Click Here for Free Porn!), but you can actually test for this value if you have given the Submit input a name. I may be wrong about this, though. Thus if you relied upon testing for the value of the submit button to determine whether the form had been submitted (as opposed to being viewed for the first time) then you're going to get unexpected results. Right, but I was trying to come up with a way for the original poster to test to see if the user had simply hit enter or if they had actually hit the submit button (not as a test to see if the form was being viewed for the first time). IIRC he was having problems determining whether or not the user had hit enter or hit the submit button. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cron with php as apache module
On Friday, March 22, 2002, at 03:16 PM, Paul Roberts wrote: for lynx, at the command prompt i get bash: lynx: command not found I've also looked in all the obvious places for php but can't find it. the server is a cobalt raq 3 and i have a virtual host account so i can't recompile php. maybe I'll rewrite it in Perl. Try looking for links, it's basically the same thing (but don't tell the links people I said that! :) If not, why not just download and build links, and put it in your ~/bin directory or something? I don't believe it has to be admin-installed, does it? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for tutorial on XML parsing of attributes...
I'm no expert on the XML functions, but post your code and maybe we can figure out what's wrong. Erik On Thursday, March 21, 2002, at 09:24 PM, Scott Brown wrote: Ok - first off, I've found a few... phpbuilder has a nice number of references. But every one I've tried has ignored attributes... either that, or I dont understand what I'm doing. I retrieve from a distant server an XML response to an inquiry: ?xml version=1.0 ? response version=1.0 requestid=some-request-identifier status code=some-numeric-code descriptionsometext/description /status domain fqdn=fqdn-identidier1 status code=some-numeric-code1 descriptionsometext1/description /status /domain domain fqdn=fqdn-identidier2 status code=some-numeric-code2 descriptionsometext2/description /status /domain domain fqdn=fqdn-identidier3 status code=some-numeric-code3 descriptionsometext3/description /status /domain /response BUT... when I parse this using xml_parse, all I'm getting out is: Name = RESPONSE -- Attributes = Array Name = STATUS -- Attributes = Array Name = DESCRIPTION -- Attributes = Array Name = DOMAIN -- Attributes = Array Name = STATUS -- Attributes = Array Name = DESCRIPTION -- Attributes = Array Name = DOMAIN -- Attributes = Array Name = STATUS -- Attributes = Array Name = DESCRIPTION -- Attributes = Array Name = DOMAIN -- Attributes = Array Name = STATUS -- Attributes = Array Name = DESCRIPTION -- Attributes = Array I cant seem to nail down how to pull the actual attribute values does anyone know of a tutorial that's going to teach me how to pull those attributes of fqdn and code? I've figured out how to get the DESCRIPTION... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache
Isn't it just a matter of setting the permissions? apache can't have read access to this directory, that's all. Erik On Thursday, March 21, 2002, at 03:28 AM, jtjohnston wrote: I'm also looking at this in my .conf. I know putting something here is the answer, but what :) Directory / Options FollowSymLinks AllowOverride All /Directory J Scott Furt wrote: Errmm... i don't know any apache groups, but if you want to do what you ask, just read the documentation, it's easy :-) jtjohnston wrote: Anyone know of a good apache group? I want to hide the structure of a directory when there is no idex.html present g J -- John Taylor-Johnston - ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Varaible Problem
Have you made sure that the correct values are even being loaded into the session variable containers? IOW, try echo $id; echo $first_name; to make sure that there is actually any value in those variables. Erik On Thursday, March 21, 2002, at 12:22 PM, Randy Phillips wrote: Hi, I have tried every example of creating a session variable I could find on php.net and have had the same results with all of them. The session variables get set on the initial page but that's the only place I can access them. I am new to php so I'm sure I have just overlooked something. Here is my latest attempt. It's a simple login page that starts a session when a user successfully logs in: $connect... $sql ... list($id,$first_name) = mysql_fetch_row($sql); session_start(); if (!session_is_registered('user_id')) { session_register('user_id'); $user_id = $id; session_register('user_name'); $user_name = $first_name; } else { echo pSession is set and should now be availalbe on all pages via a cookie. At least that what I expected.; } Sadly, these vars are available only on this page. echo pID: $user_id; echo pName: $user_name; Mac OSX Apache PHP 4+ Thanks, -- Rp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache
On Thursday, March 21, 2002, at 12:22 PM, Jason Wong wrote: On Friday 22 March 2002 00:54, Erik Price wrote: Isn't it just a matter of setting the permissions? apache can't have read access to this directory, that's all. No, he doesn't want apache to *list* files in that directory but still to be able to serve files *from* that directory. I'm not trying to argue, I just want to make sure that *I* understand how Apache works -- I thought that if you deny read access to a directory to Apache, then it won't list the files, but as long as Apache still has execute access to the directory then it should still serve files from it. Just like using ls in the shell, you can read files in a directory you cannot read, as long as you can execute the directory and know the exact filename. Am I wrong? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing variables
On Thursday, March 21, 2002, at 03:39 PM, Miguel Cruz wrote: 3. Store them in a database and just pass the index from page to page using a hidden variable. Is this a frequently-used option? A while back I thought of using a scheme like this, but then thought to myself that it would be a lot of overhead for a multi-part form. I wonder how often this technique is actually done? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo and Session Variables
On Thursday, March 21, 2002, at 06:26 PM, David Johansen wrote: Thanks that fixed the problem, but I have a question then. Am I supposed to put the ' in the $_SESSION[] in the normal parts of code. Thanks, Dave You should use either single quotes or double quotes in any associative index. You do not need to use them for numeric indices. $_SESSION['x_Email'] $_POST['loginName'] $form_html['button'] $count[1] $item[7] Don't forget that variables will not expand within single quotes. Use double quotes if you have a variable in your associative index. $_POST[filename{$i}] Again, not really an issue for numeric indices. $input[$c] Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database Development Price Inquiry?
On Thursday, March 21, 2002, at 08:27 PM, [-^-!-%- wrote: Hello everyone, I'm in the process of revising my db development prices, and was wondering what the best practices were. I want to keep my prices low, but I often feel like I'm not charging close to what I should be charging. ... Any feedback would be greatly appreciated. 40 hrs at $11/hr, no overtime, no benefits. But I get to learn PHP. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTMLnetscape issue
On Wednesday, March 20, 2002, at 01:11 PM, Vlad Kulchitski wrote: Sorry for repeating myself, but am lost and still can't find a solution to the following problem, I need to specify a background image for td like the code below: tr td background=images/bottomcell_bg.gif/td /tr This code works EVERYWHERE (in all browsers) but Netscape Navigator 4.xx versions. You're fighting an unwinnable battle. Give up on Crapscape 4.x, it is full of bugs. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multipage form
On Wednesday, March 20, 2002, at 11:57 AM, David Johansen wrote: I was just wondering what was the best way to handle a multipage form. Would the best way be to keep passing the variables through the forms as hidden values or should I use sessions and store all the values as session variables? What's the best way to handle all of this? Also the different forms will all be in the same php file that loops to itself if that makes a difference. Thanks, These can be a pain in the ASS. But as for the answer to your question, it's really more a matter of personal preference and the particular application you have. For instance, if I were writing a shopping cart or some extremely complicated sequence of forms that fork off into a tree-like structure, I'd probably just give up on hidden form fields and use session variables. But because session variables can be tricky to unset (you have to make sure the user explicitly executes a script to unset them), I try to avoid it when I can. I have a linear multi-part form (not one that branches into different directions) where I take user input and throw it all into hidden form fields -- very tedious, yes, but I have finer control over what values get passed around as the user moves on. Side note: the trickiest thing can be getting multiple-listbox values to be passed on, since it'll be hard to put multiple values into a single form field. The way to do it is a miniature loop for each case where you need to do this, that places each value into an element of an array -- then implode the array into a string and put the string into the hidden form field. Explode the string back into an array on the next part of the form. For a branching, tree-like system I'd probably use sessions unless for some reason you can't -- just make sure the user has a way of knowing what's in their cart (or equivalent for your site) somewhere, so that if they closed the window in the middle of filling out the form, possibly expecting it to reset all of their work, then they won't be surprised when they try to fill out the same form later and see all of their old values from their session. Good luck Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cvs data PHP
I was wondering if there is a way to access CVS from a PHP script. Obviously there's some way to do it, SourceForge does it. What I'm wondering is how -- Somebody commits an XML file to CVS. Later, somebody else accesses the PHP script. The PHP script queries CVS for the latest version of the file, and reads its contents. (This is because I actually want the PHP script to parse the XML and do later things with this info.) Does anyone know how this is done? Rather, can anyone point me to a tutorial or resource on this topic? Thank you, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: html form select list selected
On Wednesday, March 20, 2002, at 04:23 PM, ROBERT MCPEAK wrote: Whoops! Still won't work but that code should read: echo form; echo select name=\display\; echo option value=\true\; if ($display==true){echo selected;} echo Display; echo option value=\false\; if ($display==false){echo selected;} echo selectedDon't Display; echo /select; echo /form; First of all, this form doesn't have a method or action attribute -- so I'm not sure which script you intend to call with it, or what HTTP protocol you intend to pass the data with. But assuming it's the POST method and the action is PHP_SELF, and that you are using PHP 4.1.x or greater: // perform a test to see which should be selected if ($_POST['display'] == 'true') { $select_if_true = selected=\yes\; $select_if_false = selected=\no\; } elseif ($_POST['display'] == 'false') { $select_if_true = selected=\no\; $select_if_false = selected=\yes\; } // create the form, including the above-defined variables $form_html = form method=\post\ action=\ . $_SERVER['PHP_SELF'] . \ select name=\display\ option $select_if_true value=\true\Display/option option $select_if_false value=\false\Don't Display/option /select /form; // print the form print $form_html; HTH Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac Classic and PHP...
On Monday, March 18, 2002, at 06:01 PM, Chuck PUP Payne wrote: The guy paid $6000 for this Mac, and the guy doesn't want to even hear new hardware. So it doesn't matter I am talk to a wall. ... I am dealing with just cheap people. So again thanks for all the comments and info. Good luck, then. The fact of the matter is that computers sometimes do eventually need to be replaced, and yes this means more money. Like cars. If they don't want to put Linux on the computer they already have, which is like recycling a Ford Festiva into a Land Rover Defender, then the $150 offer you made them seems like the best thing they could do. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making a simple borderless pop up window with a Close button
On Tuesday, March 19, 2002, at 07:12 AM, Denis L. Menezes wrote: I am making a database website where I need to add a small help button for every field on the form. Whenever the user clicks the small help button, I wish to show a titleless popup window containing the help text and a close button. Can someone help me with the php script for this. This kind of trick isn't done in PHP but rather in JavaScript. Search google for javascript tutorial and if you want to narrow that down some add window open resize. As has been mentioned on this list five times over the past 24 hours, JavaScript is code that is executed by the user's browser (as opposed to PHP which is code executed by the server), which provides the ability to manipulate browser objects like windows. I don't know much JavaScript so I can't answer your question directly, sorry. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making a simple borderless pop up window with a Close button
On Tuesday, March 19, 2002, at 09:47 AM, Joe Webster wrote: It only works in IE -- it makes use of the 'Full Screen' (F11) option and tricks IE into doing so... hope you don't want it to work in NS, Opera... or anything else I never realized that! But, (not that I didn't believe you but I like to see for myself) I just tested it in Mozilla 0.9.9 for OS X, and it -sort- of works. The Favorites bar appears, but the navigation bar (with forward/backward buttons) doesn't appear. BUT... with a bit of fudging, I can get it to appear (playing with the menu settings and clicking the Toolbar button that appears in every Aqua window). Also, the window is resizeable. So it looks like you can suggest to Mozilla that it not display the nav bar, but you can't force it like you do in Explorer. Erik PS: some testing with MSIE5.1 in OS X shows that by clicking the toolbar button mentioned above, you can actually bring back scroll bars, nav bar, and window-resizeability. But I'm glad to know that this isn't a true JavaScript feature, rather an MSIE extension of sorts... Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql - php help
On Tuesday, March 19, 2002, at 10:57 AM, Denis L. Menezes wrote: I have three fields(input boxes) in a php form as follows : $name $rank $age My MySQL table is called tblAddress. I know how to connect, but I do not know the Insert statement. Can someone please advise me how I can insert the above values in the tables tblAdddress in columns name, Rank, age respectively? There are a couple of ways to do it. $sql = INSERT INTO tblAddress VALUES ( . $_POST['name'] . , . $_POST['rank'] . , . $_POST['age'] . ); mysql_query($sql, $db); // $db is your database connection pointer That one only works if the first three columns in the table are the ones you want to insert the values into. The next version is like this: $sql = INSERT INTO tblAddress (name, rank, age) VALUES (' . $_POST['name'] . ', ' . $_POST['rank'] . ', ' . $_POST['age'] . '); mysql_query($sql, $db); // $db is your database connection pointer That one works if you don't know the layout of the table, but know the names of the columns you want -- it's specific, and more portable than the first way (in case you ever alter your table structure). The last way to do it is like this: $sql = INSERT INTO tblAddress SET name=' . $_POST['name'] . ' rank=' . $_POST['rank'] . ' age=' . $_POST['age'] . '; mysql_query($sql, $db); // $db is your database connection pointer In the above examples, I've made the assumption that the form is being sent via POST and that you are using PHP 4.1.x with register_globals off, adjust accordingly if this is not the case. Also note that the singlequotes used to surround each database entry value aren't always necessary, I think that with INT columns they can be omitted (but are required for string columns since spaces are tokens in this case [I think]). HTH, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION PROBLEM
On Tuesday, March 19, 2002, at 02:56 PM, karthikeyan wrote: What does this error means - Warning: Cannot send session cookie - headers already sent by (output started at /home/web/public_html/karthik1.php:7) in /home/web/public_html/karthik1.php on line 35 Warning: Cannot send session cache limiter - headers already sent (output started at /home/web/public_html/karthik1.php:7) in /home/web/public_html/karthik1.php on line 35 Are you trying to start a session after the headers have already been sent? Usually this happens on accident if you have some HTML whitespace being sent on accident (an extra line in an .inc file, or an extra line before the ?php at the top of the page...). Make sure your session_start() function is before any HTML output, whitespace or no. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML (to XML?) to PDF
On Tuesday, March 19, 2002, at 03:48 PM, Chris Boget wrote: I need to take what is presented to the user (ie, the data less the HTML tags but maintaining the formatting) and turn it into a PDF file. I know I can use PDFLib to turn data into a PDF. However, it doesn't understand HTML so I can't just send it the same thing I'm sending to the browser via stdout. Is there a routine, a class or a set of functions out there that would take the result and give me just the data the end user sees (ie, less the HTML tags)? Or even turn the HTML into XML? One thing to remember, since this is using the results of a parsed template, I would need to be able to do all of this on the fly. I don't necessarily need the code that does this, just pointers on where I can go look and find out how I can do this. Thanks for any help you can provide! Hm. If you can't store the data as XML from the beginning (doesn't it make more sense to go from XML to HTML than vice versa?), you might still be able to get away with using XSLT to do what you want. I think in order for it to work your initial document has to be some kind of XML, but XHTML should work in theory. What I just said came out somewhat confusing -- If your initial document is in XHTML form, you should be able to use XSLT, since XHTML is a form of XML. HTH, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return the column names of MySQL table?
On Tuesday, March 19, 2002, at 05:43 PM, Kevin Stone wrote: I simply need to return a list of column names of a MySQL table. What's the syntax to do that? SHOW COLUMNS FROM tablename; Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting html entities outside of tags
On Friday, March 15, 2002, at 03:17 PM, Alain Dresse wrote: I want to allow the users of my site to insert text with anchors, bold and italic html tags. I have filtered out all the other tags. I now want to convert the other , , quote, double quote and to html entities. If I use the function htmlspecialchars, it of course also quotes the valid anchors. I was wondering about a similar scheme to this -- here's my idea: take all user input, and in addition to running it through error-checking functions, run it through htmlentities() to turn all of its HTML into entities. This prevents any user-input HTML from being created (it becomes literal). Then, running str_replace() for each HTML tag that I -want- to enable. str_replace is faster than any of the regex functions, from what I hear, and if I want to enable just b, i, em, strong, and a tags, it seems like I could just str_replace the entities for these to transform them back to proper tags (i.e. change lt;bgt; back to b). This seems like an efficient way to do it, but is it any faster or better than just using strip_tags() ? When I originally thought of doing it, it seemed like a good way of getting around the fact that user-specified JavaScript attributes are still allowed in strip_tags()-parsed text. But now that I think about it, there's no difference Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Driving me nuts, need one second of your time
On Friday, March 15, 2002, at 06:14 PM, cosmin laslau wrote: Thanks in advance for whoever sees what I am sure is a glaring and obvious flaw in the coding. I've been looking at it for an hours and just can't get anything from where I'm standing, maybe a different perpective will help. You're declaring your connection parameter as a string db and you probably want it to be a variable $db. Make sure this variable contains a database connection pointer. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XSLT parsing causes passed by reference error
On Friday, March 15, 2002, at 06:46 PM, Edward Tanguay wrote: I have this hosted at my ISP. The phpinfo() shows that they have: Linux 2.4.3 PHP Version 4.0.4pl1 Sablotron XSLT support: enabled Which annotations are you refering to? Ask them if they will upgrade to a PHP 4.1.x version, preferrably 4.1.2. I understand that there was a significant change to the XSLT functions in PHP between 4.0.x and 4.1.x (you can check the SourceForge CVS changelog for the details, but I'm almost positive of it). That is really the only advice I have, since I know nothing about the inner workings of these extensions -- only that in my PHP 4.1.2 installation, everything seems to work (though I haven't done any advanced XSLT processing). Good luck Edward, sorry I can't be of better help. Oh, on second thought, maybe I can! I recorded every step I made in recompiling PHP with XSLT (as well as MySQL) on my RH 7.2 Linux box. If you or your ISP would like a copy of this document, I'll send it to you -- it details every step I made in setting up PHP with XSLT enabled, as well as my (easy) installation of expat and Sablotron (both of which are required for these XSLT functions). Good luck, and btw by annotations I meant the user-input at the bottom of every PHP man page. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new_xmldoc won't work?
On Friday, March 15, 2002, at 07:04 PM, Edward Tanguay wrote: $doc = new_xmldoc('1.0'); $root = $doc-ad_root('sites'); $site = $root-ne_child('site',''); $site-new_child('title','PHP.net'); $site-new_child('url','http://www.php.net'); $site-new_child('description','The homepge of PHP'); $site-new_child('keywords','MySQL, PHP'); print $doc-dumpmem(); xslt_output_endtransform(); ? Where can I get new_xmldoc()? I could be wrong about this, but if you're trying to create a new instance of a class called xmldoc, then shouldn't you omit the underscore? Then again, I just read the man page for xmldoc() and it doesn't seem like that's what you're using here. I didn't find any reference to a function called new_xmldoc(), though I did see a big disclaimer that the DOM-using XML functions in PHP are subject to change and are somewhat unstable. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Appropriate headers for Forcing download on IE/Mac and open with stuffit?
On Monday, March 18, 2002, at 05:03 AM, Jimmy Lantz wrote: and preferably also automatically let them open the file with stuffit expander. (it works with files downloaded from a webpage/apache without PHP) This feature depends on how the user has their browser preferences configured. In IE5.1, it's Explorer - Preferences - File Helpers, then choose the suffix/extension of the file in particular and make sure that it is set to process with application or whatever, and that the application is Stuffit Expander. Note I am referring only to the Mac IE 5.1 and have no experience with IE on Windows. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] object reflection in php?
On Monday, March 18, 2002, at 06:28 AM, Filippo Veneri wrote: Just to make myself understood: class obj { var $field; function obj( $value ) { $this-field = $value; } } $o = new obj( field value ); How can i know, if possible, that the instance of obj pointed to by $o has a field named field? This would be useful to write an object to a database without knowing its structure 'a-priori'. Couldn't you just add another method called return_field_name() to the class? Then you could run this method from the script and you will be given the value of the field name. Your code would look like this: class obj { var $field; function obj($value) { $this-field = $value; } function return_field_name() { return $this-field; } } then in your code you would do something like: ?php $o = new obj(field value); print $o-return_field_name(); ? This might not work, I don't know much about OO. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and enable-trans-sid
On Saturday, March 16, 2002, at 09:04 PM, [EMAIL PROTECTED] wrote: I have compiled php with the enable-trans-sid (for the site I am using I can NOT use cookies) when I start a session or store something in _SESSION['varname'] varname can not be accessed on other pages nor is there a file in the /tmp file nor does my URI change with a session id Are you forgetting to put the buck ($) in front of _SESSION['varname'] ? Looks like it from the example you give above, unless that's a typo. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unscriber please
On Sunday, March 17, 2002, at 12:20 AM, [EMAIL PROTECTED] wrote: Roy Daniel , ST IT Developer System - PT BERCA COMPUTEL My E-mail : [EMAIL PROTECTED] and : [EMAIL PROTECTED] / [EMAIL PROTECTED] My ICQNumber : # 103507581 My Phone Cell : 0816-1192832 What embarrassing information to attach to an unsuccessful UNSUBSCRIBE request! :) If you still wish to unsubscribe, see the very last line of this email. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI
On Sunday, March 17, 2002, at 10:07 PM, David Duong wrote: Can PHP be considered CGI? Would PHP replace Perl as the main language of CGI? Unless you are specifically referring to Common Gateway Interface, the term CGI should be deprecated in favor of the term server-side scripting language. It's easier to say CGI, but you refer to something very specific when you do. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sablotron and LINUX trouble
On Monday, March 18, 2002, at 12:34 PM, Mike Eynon wrote: I have got the Sablotron XSLT extension working in Windows, but now am having trouble getting it to work on my LINUX servers. I just got it up and running in Linux with PHP 4.1.2 the other day. I have tried reading http://www.devshed.com/Server_Side/XML/XSLTrans/print to find the answers (which I got from earlier posts), but it doesn't seem to give me what I need. That's just a good tutorial to using XSLT with PHP, not so much an installation guide. I have downloaded the latest 4.1.2 php from php.net, which is supposed to contain the Sablotron stuff. When I configure before the build with the line: ./configure' '--with-mysql' '--with-gd' '--with-xslt-sablot' '--enable-xslt-sablot' '--with-xslt' '--with- apxs=/usr/local/apache/bin/apxs I get no errors. I then make without errors, and finally 'make install' without errors. BUT! When I do a phpinfo(), I do not see the xslt extension being loaded, and when I make a call to xslt_create(), I get the following error: Fatal error: Call to undefined function: xslt_create() in /usr/local/apache/htdocs/help/index.php on line 45 When I go and look into the config.status file, I see the following: checking whether to enable xslt support... no checking whether to enable the XSLT Sablotron backend... yes checking libexpat dir for Sablotron XSL support... no When I try to just have --enable-xslt, I get an error in the configure script: configure: error: not found. Please re-install the Sablotron distribution The problem is that you can't just compile PHP with support for Sablotron and XSLT, you need to have Sablotron and the Expat parser libraries installed on your system first. Doing this couldn't be easier: Download latest expat tarball first, then build it (./configure ; make ; make install -- no ./configure options needed unless you really need something special) :: http://www.jclark.com/xml/expat.html Next download latest Sablotron tarball and build that (same thing, a simple ./configure ; make ; make install -- will work fine out of the box) :: http://www.gingerall.com/charlie/ga/xml/p_sab.xml Finally, remove the config.cache files and `make clean` your PHP and Apache source directories, and recompile PHP. Be sure to include the --enable-xslt and --with-xslt-sablot ./configure options. If you have done default installs of expat and Sablotron (I think they automatically install into /usr/local/lib), PHP knows where to find them and will take care of it. Mike, if you want I have a log of the exact commands I used to do this, and can send them to you if you want. Let me know how this works for you -- it'll take you less than a half hour from start to finish to do all this. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printing in HTML or PHP
On Monday, March 18, 2002, at 02:57 PM, Daniel Ferreira Castro wrote: I would like to print the line bellow on my HTML generated by a PHP file. How can I do it? The line is: link rel=stylesheet type=text/css href=default.css ?php print link rel=\stylesheet\ type=\text/css\ href=\default.css\ /; ? E Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] U.S. Section 508 Guidelines
On Monday, March 18, 2002, at 02:22 PM, pong-TC wrote: It is quite off the topic. I think most of you work with form while you are using PHP. Does anyone need to conform your form webpage to ADA compliance? It is a U.S. Section 508 Guidelines for handicap people to access the webpage. However, when it applies to the webpage that has many form elements, it seems to be clumsy for me. For example, I have to put all labels in fron of text boxes, radio box, select boxes. Does anyone has any idea to get around and to make it pass the compliance? I am using the www.cast.org/bobby to test my webpage. Well, the point of 508 is to encourage web developers to create content that is accessible to everyone, regardless of disability. If you try to get around this without actually incorporating the required accessibility aids, then you're not really meeting the requirements of 508. Unless there's a problem with the parser at www.cast.org/bobby, the best (and most ethical, IMO) thing you can do is conform to 508 as required and not subvert the parser. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL and indexes
On Monday, March 18, 2002, at 03:40 PM, Jennifer Downey wrote: Just wondering, does a table have to have an index? If so what should I consider when making a colum an index? You're not required to have an index, as far as I know. It's just that an index is a way of optimizing retrievals to and from the table. Think of an index as a mini-table or meta-table that keeps track of a specific column in your actual table -- the RDBMS prefers to store all of the data in its own order, but the index stores a map of one of those columns according to a more search-friendly order. The rule of thumb with indexes is to use indexes on columns that you search frequently. So, if you rarely do any searches based on pet_hunger, then don't index that. But you might often do lookups for pet_name, so that would be a good one to index. Although you have a petid column, it's VARCHAR and thus I have a feeling it's not a traditional ID column. By that I mean it's not a column with a unique value for each row in the table. If you really want to take advantage of the true power of a RDBMS, you should create a traditional ID column like the following: pet_uniq_id PRIMARY KEY AUTO_INCREMENT NOT NULL which will automatically generate a new unique value each time you add a record. This will help you immeasurably if you ever decide to normalize this table. From what I can tell, your table as is does not appear to be normalized, which means that while it may be functional, you're not making the most of what your RDBMS gives you to work with. Strongly recommended book: MySQL by Paul DuBois (New Riders). Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printing in HTML or PHP
On Monday, March 18, 2002, at 03:49 PM, Daniel Ferreira Castro wrote: I need to use it with fwrite not print :-) Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Monday, March 18, 2002, at 02:57 PM, Daniel Ferreira Castro wrote: I would like to print the line bellow on my HTML generated by a PHP file. How can I do it? The line is: link rel=stylesheet type=text/css href=default.css ?php print link rel=\stylesheet\ type=\text/css\ href=\default.css\ /; ? ?php $fp = fopen(./filename.txt, w); $string_to_write = link rel=\stylesheet\ type=\text/css\ href=\default.css\ /; fwrite($fp, $string_to_write); fclose($fp); ? Does that work for you? Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Working with IP addresses
On Monday, March 18, 2002, at 04:07 PM, Charles Williams wrote: The above a just a few examples. I need to be able to grab either the IP addresses or the ranges and verify that when an IP is entered at a later date and compared to the above types of previously saved data that the IP is within the range(s). I hope I explained that ok. ;) So basically I guess I just need a way of, after retrieving the info from the DB, splitting the IP (range(s)) apart and then comparing the IP entered to those in the array(?) to verify that it was a good entry. I would store the IP number into four separate columns in a database table, one column for each part of the IP. This is just to be safe, really you only need two (one for the domain and subnet numbers, and the last for the machine number) but if you ever needed to cross subnets then you'd be glad you had set up your data in this flexible way. Use explode(., $ip_input) to split the parts and then insert them into the database. Then just test to see if the machine number is between two given machine numbers and that the domain + subnet numbers are the same as the database domain + subnet numbers. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac Classic and PHP...
On Monday, March 18, 2002, at 04:22 PM, Chuck PUP Payne wrote: Does anyone know a good web server beside WebStar for the Mac Classic OS, that will allow you to run PHP with it? I have a client that is looking for such an animal. I recommended WebStar because I know it will let you run cg, but I am not sure about PHP. WebStar is the only professional web server that I know of of Mac Classic. I don't think there is such an animal for the classic OS. I have tried to talk them into move to OS 10.1.3, but that like talking to the wall. Also I need to know where I can find free ODBC drivers that will let them contact to MYSQL or Filemaker pro. Yeah, I need to run PHP from my Atari 800 too. Can someone send me a binary? :) Good luck, Chuck! Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac Classic and PHP...
On Monday, March 18, 2002, at 05:16 PM, Chuck PUP Payne wrote: Thanks, I am pushing them to go to OS X, but they are PPC 8500, which can only go to Mac OS 8.6, maybe 9. They don't want to buy a new computer, I personal have a G4 and Snowflake iBook and am running 10.1.3 with Apache, PHP, and MySQL. I told the I search and ask, which I have so thanks guys. Recommend them a cheap Linux box. You could probably set yourself up with a web server for less than a hundred bucks, just need a Pentium 1 with a crummy handmedown monitor and an ethernet card. Mandrake is supposed to be incredibly easy to use and graphically configurable, and if these people really want to get going with PHP and web serving then they're probably willing to learn a little Linux... or they could get someone else (yourself?) to administrate the box for them. Or even put the 68k linux distro (I forget its name) on their 8500. By the Eric Price, I could see PHP on Atari ST(they have the same chips as the Mac Classic, 68K) and I know in England and Germany are still used by many and are even on the internet, but not an 800. I still to this day write code in Atari Basic on my 800. I miss my Atari ST 1040, but I gave that up for my first mac, Power Book 145B, but I am wandering. ;) I must have had about 300 games for my old Atari 800. Gallahad and the Holy Grail, Ulysses and the Golden Fleece, Jungle Hunt, Pitfall, Haunted House, man... I wish I still had them. Then again, it might be like those movies that you remember so fondly as a kid but then you see again fifteen years later and you're like what was I thinking? The memory ends up being better than the reality. My Atari is best left in my attic... :) Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Is Inserting (the same) Database Record Multiple Times In My HTML Output
On Friday, March 15, 2002, at 12:19 AM, hugh danaher wrote: You're the second one I've seen using do. What do? Is it in the php manual and I missed it? do { ... } while ( ... ); Runs the while loop at least once, regardless of whether or not the while conditional evaluates to TRUE. Somewhat unrelated, but I used to use this technique for looping through a result array from a mysql_fetch_*() function if the internal array pointer has already been bumped to the second position by a containing while loop. Now I just use two result container variables instead of the same one, since it's conceptually a little cleaner (than worrying about the array pointer's position for two separate loops that overlap each other). I changed your code slightly (to major if it's your baby). It might puke if the $row is empty for the While loop. If it does, try an @ sign before the while. I didn't test it but it looks like should go. Or, generate some interesting error messages. My experience with programming is limited, but I was under the understanding that the @ sign should be used only suppress possible unexpected error messages from users; that using it to suppress known errors is really not as good a solution as finding out what is causing the error and fixing it... of course, sometimes in a pinch you have to MacGuyver the thing I guess. Just some advice :) Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Targetted redirection?
On Friday, March 15, 2002, at 10:27 AM, Analysis Solutions wrote: Now, put all those files on your machine. Hit index.php and you'll see everything normally. Then, uncomment the header function in left.php or right.php and you'll see that page jump out of the frames. But, turn the header on in index.php or index2.php and you'll still be in the frames. Is this because the frame of the _top page needs to be a child of the parent _top page? That is to say, if the frameset is not created by a particular page A then the pages with the header() function do not consider page A to be their _top ? Good example. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting values from multiple select
On Wednesday, March 13, 2002, at 04:31 PM, Scott St. John wrote: If I send 5 fields to the next page PHP will show me one when I echo the variable to the page. If I try to split the varaiable I still get only one value in the echo. Tried to reponse.write it in asp and I get the string with comma seperate values. Did you try putting brackets at the end of the input names? This tells PHP to put the values into an array, whose key is the name of the input. select name=choice[] multiple=yes option value=aA/option option value=bB/option option value=cC/option /select This might work for you, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Targetted redirection?
On Wednesday, March 13, 2002, at 07:36 PM, Analysis Solutions wrote: Sure it works... execpt when people who have Java'sCrap turned off come to your site. Oh, and then there's the folks with browsers that don't have JS at all? HTTP headers work across all browsers. header('Location: http://foo.org/') is the real solution. For more info on why not to use Java'sCrap and how accomplish the same things without it, see http://www.analysisandsolutions.com/code/weberror.htm?j=y I agree with what you say -- never rely on JavaScript. A good rule of thumb (IMO) is to make sure that your site works perfectly and does exactly what it should using HTML/PHP code alone (test with JS turned off), and then add features with JavaScript that may make it -better-, but not features that are ever -required-. For instance, make sure that your PHP validates the forms that are submitted to the server, but if you have already done this then you can add JavaScript form validation so that the user doesn't have to wait for a full resubmit to make sure that they have everything. There are other ways that I can see JS enhancing a web site, as long as you don't require JS to do what you want... but in all honesty I haven't learned much JS so even I don't really take this route. It's just a theory. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: getting values from multiple select
On Wednesday, March 13, 2002, at 10:27 PM, David Robley wrote: If you are using a SELECT MULTIPLE you need to name the item as an array, e.g. NAME=multi[] - then loop through the array in the target script to extract the values. Don't forget to either define a default selection or check for 'none selected' Such as if ($_POST['multi']) { // loop thru the array and extract the values } else { // there were none selected so don't loop thru // the array (or you'll raise an error) } Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting values from multiple select
On Thursday, March 14, 2002, at 09:33 AM, Scott St. John wrote: Yes, I have tried that. To view them on the next page I would call them as $choice[0];$choice[1];, etc, but only the first item in the list is available. Hm... have you tried using a loop to get their values, rather than using the numeric indexes? Like this: foreach ($choice as $array_element) { echo $array_element; } This will go through the entire array, regardless of numeric index, and echo the value of each element in the array. Try this, if it doesn't work then perhaps only one value is being passed to the receiving script. Have you made sure your listbox features the attribute multiple=yes and have you made sure to select more than one item in the listbox by holding down either Alt (PC) or Cmd (Mac) as you make your selections. If you're only selecting ONE item, then only one item will be passed to the receiving script. Use the above techniques to make sure that you are actually passing more than one value. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get the greatest key of an array???
On Thursday, March 14, 2002, at 09:47 AM, Alex Elderson wrote: How can i get the greatest key of an array?? $array[1] = ...; $array[5] = ...; $array[0] = ...; $array[10] = ...; $array[7] = ...; $greatest_key = ??? (this must be 10 in this example) I think you mean the element with the greatest index? It's not guaranteed to be the greatest element in your array, depending on how you have set up your indexes (associative or numeric), but the end() function should do it: http://www.php.net/manual/en/function.end.php It sets the internal pointer to the very last element in the array. Python, incidentally, has a neat way of doing this: array[-1] (of course they're called lists, not arrays, in Python). Just a side note. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DHTML Trouble please help
On Saturday, March 13, 2010, at 10:15 PM, Jennifer Downey wrote: I am no DHTML expert and don't even know the language also didn't know where to post this. But after today I am going to learn. Isn't DHTML more of a buzzword? i don't think it's really a language. It just refers to using scripting languages and plugins like JavaScript, Flash, CSS tricks, and even server-side manipulation to achieve an effect. There's a lot of stuff on this topic at http://dhtmlcentral.com/ if you're interested. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting values from multiple select
On Thursday, March 14, 2002, at 09:52 AM, Scott St. John wrote: Ok, how about a code snipet since I seem to be blind this morning. The select box code: select multiple=yes name=groups id=av ? $sql = select groupID,groupName from groups order by groupName; ... Any eye openers? Thanks, -Scott Sure! First go get a cup of coffee! :) Then change the first line to say this: select multiple=yes name=groups[] id=av Let me know how that works for you. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea/textarea
On Thursday, March 14, 2002, at 10:26 AM, Vlad Kulchitski wrote: The only problem I have is I need to display textarea on step 3, and once again the same textarea on step 4 so that user has another chance to review what s/he's written in and on the fifth page all date submitted to db. The problem though is that it adds slashes, and on the submission page (page 5) there's like three slashes for the info collected via textarea. Basically, for instance I submit I'm Russian on step 3, by the time this data reached final step it's I\\\'m Russian. Does the stripslashes() function solve your problem? I'm interested in hearing about it. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session problems
On Thursday, March 14, 2002, at 02:15 PM, Daniel Ferreira Castro wrote: If it validates the user, then he creates a session called login_session and open another file called s_proj.htm throug the line header(location:http://pinguim/pb/s_proj.php;); The problem is on my login.php I have the block session_name(login_session); session_start(); session_register(login); session_register(pass); $HTTP_SESSION_VARS[login]= '$user'; $HTTP_SESSION_VARS[pass]='$pass'; mysql_close($link); header(location:http://pinguim/pb/s_proj.php;); and I wish to retrieve at s_proj.php the values of the session variables login and pass registered for my login_session session. How can I do it? Two things: (1) at the top you say s_proj.htm but I am assuming this is a typo and you mean s_proj.php (2) you have variables in single quotes, which will prevent them from expanding. You can drop the single quotes if you want. (3) If you are using PHP 4.1.0 or greater, then there is a much easier way to write this script: session_start(); $_SESSION['login'] = $_POST['user']; // use $_GET if that is the method you're using $_SESSION['pass'] = $_POST['pass']; // use $_GET if you are using that method mysql_close($link); header(location: http://pinguim/pb/s_proj.php;); HTH, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XSLT parsing causes passed by reference error
On Wednesday, March 13, 2002, at 06:13 PM, Edward Tanguay wrote: Fatal error: Only variables can be passed by reference in /home/tanguay/test/testxslt.php on line 7 when I run this code: ?php // Allocate a new XSLT processor $xh = xslt_create(); // Process the document, returning the result into the $result variable $result = xslt_process($xh, 'content.xml', 'website.xsl'); I was curious about this, since I just recompiled with XSLT and Sablotron support myself. I read through the annotated manual page for xslt_process(). Have you checked it out? It appears that this extension is still fairly experimental, so the way that the program behaves may differ depending on which version you're running. Which version of PHP are you using, for which OS? Did you compile using the --enable-xslt and --with-xslt-sablot configure parameters? Try some of the workarounds suggested in those annotations, specifically the one which suggests that xslt_process() doesn't like NULL arguments. It'll be ugly, but perhaps you can use implode() to read those files into a string, and get it to work by passing string references rather than filenames. If you really want to use filenames, try using an absolute path, try using ./ before the file names (assuming those files are in the same directory as the script itself). Finally, consider passing a joke array as the 5th and 6th arguments to the function. It may be that in your particular build you need to use workarounds. Be sure to post the results of your experimentation for the benefit of the rest of us. Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] repost: appending to text file
On Thursday, March 14, 2002, at 03:06 PM, Gav wrote: What I do want to do though is create a gallery feature so what I believe I need to do is to append the info above into a textfile named total.txt or something. So that everytime a separate file is saved on to the server, it's info is added to this total file. Is this the way to go about it? Or is there a php function that can see what files are in the directory, open them and then use the info that way? I was told that a database is the way to go but I have no experience of these at all. A database will help you to keep data in separate entities (by keeping X information in an X_info column, Y information in a Y_info column, for example). A database is also very fast. Database knowledge is also worth having on your resume. I recommend you download MySQL, an easy-to-use and free relational-database-management-system. No doubt you've seen a lot of references to it from PHP stuff, because the two are practically hand-in-hand partners. If you can afford a book, get MySQL by Paul DuBois from New Riders books, and read the first chapter to get a feel for how the SQL language works (so you can write SQL statements into your PHP code). Later when you have more time, finish the book, it's an excellent reference for the MySQL database system. If you don't want to spring for the book but are still interested, there are a million tutorials on using MySQL. But a whole database just for this one script seems to me to be some serious overkill. I recommend that you keep your data in an XML file instead -- this is actually really really easy, probably easier than using MySQL, but not as fast or as powerful for doing queries or searches. But you can mark up the data to keep entities separate, and append new Flash objects' data to a master XML document like you describe. When someone wants to view the gallery, just parse the XML file, or run it through an XSLT style sheet or something. If you need to add to the gallery, just read the XML file into memory, insert the new XML code for whatever it is you need to add, and write it back to the file. The PHP XML functions are at http://www.php.net/manual/en/ref.xml.php and there are tutorials at DevShed, SitePoint, and a dozen other excellent web support sites. Either a database or XML can do what you want, it's really up to you. I think the XML way will get you your results soonest, but learning MySQL will have a long-term value if you ever intend to do any back-end work or just want to know more about databases. It's fun stuff. Erik PS: you can combine XML and MySQL to achieve some really powerful data storage tricks, though sometimes it's overkill to do so (depending on the extent of your project). Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Online Feedback and Application
On Thursday, March 14, 2002, at 04:00 PM, David Johansen wrote: I would like to make a little online feedback and application form. I was trying to decide if I should use the mailto action of the form or if there's some better way that I can do it in PHP. Is there a way I could just write it to a file or something in PHP or is there a more typical and better way to pull this off? Thanks, Fundamentally, the script you are wondering about is known as a guestbook, although it has been rarely used for that purpose since the late nineties. Someone enters some text into an HTML input, hits submit and the data either gets stored in a file, database, or is emailed (or processed in some other way). Whether or not the data is visible by other visitors or only by yourself is entirely up to you -- PHP handles such scripts incredibly easily. Julio Nobrega suggested storing the data into a database, which is a good idea especially if you expect a lot of feedback or have a somewhat complicated feedback form that you would like to be able to run complex queries on. You could also simply write this data to a text file or multiple text files, though if you get a lot of feedback it -could- get out of hand. And email is another option. PHP lets you do all of this. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() question
On Thursday, March 14, 2002, at 04:34 PM, Edward van Bilderbeek - Bean IT wrote: you can't use a variable as a parameter for the included file... because include does nothing else then putting the text of the include file on the place of the include statement... Are you sure about this? I'm almost positive that PHP is flexible about accepting variables or strings as function arguments in most cases. I just tested it, and it seems to work fine... $includefile = './leftnavigation.inc'; include($includefile); I posted a question on this list about a month ago, and someone said that you can use variables or strings in many cases -- just remember that the variable expands to the string BEFORE being processed by the function. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Use of $_SESSIONS in PHP 4.1.2 with register_globals off
In PHP 4.1.0 or greater, all you need to use sessions is this: ?php session_start(); // this tells the script to either create a session // or to use a current session if the script has been // passed a session ID via a cookie or GET request $_SESSION['var1'] = $varablename; // this tells the script to take the value of the // variablename variable and assign that to the // var1 variable, which is a session variable. $_SESSION['var1'] = $_POST['var1']; // this tells the script that the user-supplied value // contained by the var1 variable from a POST request // (usually from a HTML form) should now be contained by // a session variable called var1. echo $_SESSION['var1']; // this does exactly what you think it does, and of course // this variable can be manipulated in other ways. echo() // is just an easy example. Since the $_* variables are always global (hence the name superglobals), you never need to worry about the scope of these variables. And you never need to use session_register() again. All of the above code is register_globals=off-compliant. Erik On Thursday, March 14, 2002, at 04:36 PM, Donna Dufort wrote: I'm attempting to understand how to use session variables with register_globals off. Listed below are three very simple pages that pass session variables. With register_globals off: I'm only able to see $ses_var1 if I refer to it with $HTTP_SESSION_VARS['ses_var1'] or $_SESSION['ses_var1'] and not by using $ses_var1. This only works if I used session_register('ses_var1') then set it using $ses_var1 = something;. Per everything I've been reading I expected it to work more like how I have ses_var2 setup but ses_var2 only produces output on page1.php Also I didn't expect $HTTP_SESSION_VARS['ses_var1'] to return anything since I did not declare them as global in page2 or page3. With register_globals on: Same results as above except $ses_var1 does produces output on any page that asks. Am I doing something wrong? Using Windows 2k/IIS, we are also using Linux and Apache but we haven't upgraded that machine yet. = page1.php = session_start(); session_register('ses_var1'); $ses_var1 = Hello World; $_SESSION['ses_var2'] = huh?; echo \$ses_var1 is .$ses_var1; echo br; echo \$_SESSION['ses var2'] is .$_SESSION['ses_var2']; echo br; ? center brbrbrbrbr form method=post action=page2.php table bgcolor=#cc tr tdUsername:/td tdinput type=text name=username/td/tr tr tdinput type=submit value=submit/td/tr /table/form /center = page2.php = session_start(); echo \$HTTP_SESSION_VARS['ses_var1'] is .$HTTP_SESSION_VARS['ses_var1']; echo br; echo \$_SESSION['ses_var1'] is .$_SESSION['ses_var1']; echo br; echo \$ses_var1 is .$ses_var1; echo br; echo br; echo hr; echo \$HTTP_SESSION_VARS['ses_var2'] is .$HTTP_SESSION_VARS['ses_var2']; echo br; echo \$_SESSION['ses var2'] is .$_SESSION['ses_var2']; echo br; echo \$ses_var2 is .$ses_var2; echo br; echo br; echo hr; echo post var name is: .$_POST['username']; echo br; ? a href = page3.phpNext page/a = page2.php = session_start(); echo \$HTTP_SESSION_VARS['ses_var1'] is .$HTTP_SESSION_VARS['ses_var1']; echo br; echo \$_SESSION['ses_var1'] is .$_SESSION['ses_var1']; echo br; echo \$ses_var1 is .$ses_var1; echo br; echo br; echo br; echo \$HTTP_SESSION_VARS['ses_var2'] is .$HTTP_SESSION_VARS['ses_var2']; echo br; echo \$_SESSION['ses var2'] is .$_SESSION['ses_var2']; echo br; ? a href = page1.phpReturn to Page 1/a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please Note: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you - Tobin Associates, Inc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() question
On Thursday, March 14, 2002, at 05:03 PM, Jan Rademaker wrote: I think what Edward means is that you can't pass parameters to an included file, like include(some.inc?var=value); That's true, at least for local files. include(http://remotesite/some.php?var=value;) will work, as long as remotesite has php installed, of course. yes, a very clean way to do it (that I've used successfully) is something like: $current_page = User Login; if ($badlogin) { header(Location: http://domain.com/~eprice/badlogin.php?errormsg=; . $current_page); } This cleanly separates the string from the variable, but they are concatenated before being passed as an argument to the header() function. This passes the name of the script as a querystring variable called $_GET['errormsg'], so that the receiving script can take some action based on where the user was sent from. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() question
Oh I see. Sorry, i was thinking apples and you guys were talking about oranges. I just ran into this problem a little while ago, that's why I felt the need to butt in. Erik On Thursday, March 14, 2002, at 05:08 PM, Edward van Bilderbeek - Bean IT wrote: Jep, that was what I meant... sorry Erik, didn't read your question right... Edward - Original Message - From: Jan Rademaker [EMAIL PROTECTED] To: Erik Price [EMAIL PROTECTED] Cc: Edward van Bilderbeek - Bean IT [EMAIL PROTECTED]; Phil Schwarzmann [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 14, 2002 11:03 PM Subject: Re: [PHP] include() question On Thu, 14 Mar 2002, Erik Price wrote: On Thursday, March 14, 2002, at 04:34 PM, Edward van Bilderbeek - Bean IT wrote: you can't use a variable as a parameter for the included file... because include does nothing else then putting the text of the include file on the place of the include statement... Are you sure about this? I'm almost positive that PHP is flexible about accepting variables or strings as function arguments in most cases. I just tested it, and it seems to work fine... $includefile = './leftnavigation.inc'; include($includefile); I think what Edward means is that you can't pass parameters to an included file, like include(some.inc?var=value); That's true, at least for local files. include(http://remotesite/some.php?var=value;) will work, as long as remotesite has php installed, of course. -- Jan Rademaker [EMAIL PROTECTED] http://www.ottobak.com Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re: passing inputs
. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] --enable-xslt
A few days ago I upgraded to 4.1.2 on my RH 7.2 server. I used --enable-xslt and --with-sablot in my configure parameters because I thought it would be fun to learn more about XSLT with PHP. But there were problems (I don't have the actual error message, and would like to avoid re-configuring to reproduce it if possible), and I needed to drop both of these parameters to the configure script. I was thinking of recompiling with these parameters, and was wondering if anyone on this list knows what is required to do this -- do I need to install a program called Sablotron first? It seems like it. If anyone has a resource or somewhere I should be looking, please by all means point me in the right direction. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Targetted redirection?
On Wednesday, March 13, 2002, at 03:15 PM, Ben Cheng wrote: I have a page within a frame that uses Header() to redirect to another page. However, I don't want the redirection to take place just within that frame set. I want the page that it redirects to to cover over the frame. Is this possible? Hm... I don't think that frames were ever intended to be manipulated at the level of headers! Otherwise you could use a target attribute or something. If you're willing to use a bit of JavaScript, you might be able to reference a new window or something like a target=_blank and THEN call the header() function from there... but that's more of a workaround than a solution. Good luck, sorry I don't have any other ideas. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] --enable-xslt
On Wednesday, March 13, 2002, at 01:58 PM, Anas Mughal wrote: http://www.devshed.com/Server_Side/XML/XSLTrans/print Actually, that's the very tutorial that led me to ask about installing with XSLT configure parameters. I'm building it now, as I write this. But I was wondering about some XSLT/PHP style advice... How much of a burden does on-the-fly XSLT place on the server? I mean, relative to a typical setup. I'm playing with the idea of changing all my old HTML to proper XML files, and having PHP generate XML rather than HTML (seems trivial, since PHP doesn't really care what markup language I use to output data -- I could even do it in plain text if I was so inclined). But as PHP generates the XML, there is another step now, and that is the step of running the XML data through one of the XSLT functions (such as xslt_create xslt_run or xslt_process). I'm sure that it all depends on the strength of the server being used, but does anyone have a rough estimate of what kind of burden this extra processing has? Or a reference? Speed isn't the biggest concern, since I don't have a large number of users like some public sites. Mine is an internal site, run off a Linux server w/256MB RAM. But it seems like a lot of work for Apache to process the incoming request, hit up the PHP script, fetch data from MySQL, format the database output into XML, and then run the XML through XSLT to get HTML. And to answer the question do you really need your data in XML?, the answer is no, but this kind of thing gives my boss something to brag about to visitors: this is our temp, he's building our internal schedule-managing database-driven XML-based web application...we pay him little more than minimum wage and he gets no benefits, but he's happy with the work. Plus, it'll look good in the portfolio. Thanks in advance, Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] undefined symbol: compress during install?
On Monday, March 11, 2002, at 07:50 PM, Michael Sims wrote: bugs.php.net is extremely helpful for stuff like this, (even though strictly speaking those types of things shouldn't be submitted as bugs) and I don't think enough people out there know to check it. It's actually helped me out on 2-3 occasions... Thank you, I didn't even know that virtual host existed. I'll definitely check there too next time I'm having problems. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: reset auto_increment field mysql
On Tuesday, March 12, 2002, at 06:51 AM, Jordan S. Jones wrote: Direct quote from MySQL by Paul DuBois Just a quick plug for that book -- it is excellent. If you use MySQL for anything beyond casual experimentation, I highly recommend it as well worth the $40-50 (US) that it costs. The first chapter alone gives a few dozen examples of various ways to query the database, which usually answers any of my questions about setting up queries. There are chapters on optimizing the database, security issues, database administration, backup and repair of tables, and a huge set of appendixes with about as much MySQL information as you'd need (including the PHP-MySQL function reference). To boot, when I had a question about how to perform an insert into a table with UNIQUE indexes where I had no control over whether or not the user was entering legitimate values, I posted to the mysql-users mailing list. Within a few hours, I got the solution from a couple of people, including the author of this book himself. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variables within a string
On Monday, March 11, 2002, at 10:34 PM, Jason Wong wrote: On Monday 11 March 2002 11:10, Chris Cocuzzo wrote: $foo = Entry for . $HTTP_POST_VARS[name]; $foo = Entry for for $HTTP_POST_VARS[name]; But that's not good programming. Associative arrays should have the key quoted in order to avoid confusion with contants. See http://www.php.net/manual/en/language.types.array.php#language.types.array. donts Inside of double-quoted strings there is no need to single-quote the array key (in fact it can't be done, gives syntax error). The section of the manual you quoted states this :) I thought that it could be done like so: $foo = Entry for {$HTTP_POST_VARS['name']}; Sorry for butting in, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] --with-xml set by default?
Hello, I have a quick question, as I recompile my PHP installation up to 4.1.2: Is the --with-xml option to ./configure a standard these days? I seem to remember that in my initial PHP 4.0.6 installation I used this parameter, but I just did [root@localhost] # ./configure --help | grep 'xml' and the only options that come up are --with-dom, --disable-xml, and --with-xmlrpc. The --disable-xml option leads me to believe that --with-xml is a default option nowadays. However, I could not confirm this in the changelog, and I read all the way back through 4.0.6. Was I just mistaken in the first place by using this option? Thanks, Erik (PS: talking about a source install on Linux) Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] undefined symbol: compress during install?
I just finished doing my re-install of PHP, updated to 4.1.2. Or so I thought... everything went smoothly, I got all the right success messages during the ./configure and make processes, and thought I was ready to go -- but as I confidently started up Apache, I was greeted with this message: [root@media src]# /usr/local/apache/bin/apachectl start Syntax error on line 222 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: undefined symbol: uncompress /usr/local/apache/bin/apachectl start: httpd could not be started My setup is Apache 1.3.22, on RedHat Linux 7.2 using the PHP 4.1.2 source tarball. I have logged my entire installation (I was taking notes in case another sysadmin might need to go through this), and appended the commands I used at the end of this email. Any help is gratefully appreciated! Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] [root@media /]# /usr/local/apache/bin/apachectl stop [root@media /]# /usr/local/mysql/bin/mysqladmin -u root -p shutdown [root@media /]# pushd /usr/local/src /usr/local/src /usr/local/src/apache_1.3.22 [root@media src]# ls -lF total 20 drwxr-xr-x8 1088 1088 4096 Dec 12 17:03 apache_1.3.22/ drwxr-xr-x 13 root root 4096 Dec 12 14:50 mysql-3.23.46-pc-linux-gnu-i686/ drwxrwxr-x 16 eprice eprice 4096 Dec 12 16:40 php-4.1.0/ drwxrwxr-x 13 7801 7801 4096 Feb 27 04:18 php-4.1.2/ drwxr-xr-x2 root root 4096 Feb 28 16:57 tarballs/ [root@media apache_1.3.22]# cp /usr/local/apache/conf/httpd.conf /home/eprice/httpd.conf [root@media src]# pushd apache_1.3.22/ /usr/local/src/apache_1.3.22 /usr/local/src [root@media apache_1.3.22]# make clean [root@media apache_1.3.22]# ./configure --prefix=/usr/local/apache Configuring for Apache, Version 1.3.22 ... (other output snipped) ... [root@media apache_1.3.22]# pushd ../php-4.1.2/ /usr/local/src/php-4.1.2 /usr/local/src/apache_1.3.22 /usr/local/src [root@media php-4.1.2]# ./configure \ --with-apache=/usr/local/src/apache_1.3.22/ \ --with-mysql=/usr/local/mysql/ \ --enable-sockets \ --enable-xslt \ --with-xmlrpc creating cache ./config.cache ... (other output snipped) ... ++ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point.| ++ Thank you for using PHP. [root@media php-4.1.2]# make Making all in Zend ... (other output snipped) ... [root@media php-4.1.2]# make install Making install in Zend ... (other output snipped) ... [root@media apache_1.3.22]# ./configure --activate- module=src/modules/php4/libphp4.a --enable-module=so --enable-shared=max Configuring for Apache, Version 1.3.22 ... (other output snipped) ... [root@media apache_1.3.22]# pushd ./src/modules/php4/ /usr/local/src/apache_1.3.22/src/modules/php4 /usr/local/src/apache_1.3.22 /usr/local/src [root@media php4]# make ... (output snipped) ... [root@media php4]# popd /usr/local/src/apache_1.3.22 /usr/local/src [root@media apache_1.3.22]# make ... (output snipped) ... [root@media apache_1.3.22]# make install ... (some output snipped) ... ++ | You now have successfully built and installed the | | Apache 1.3 HTTP server. To verify that Apache actually | | works correctly you now should first check the | | (initially created or preserved) configuration files | || | /usr/local/apache/conf/httpd.conf || | and then you should be able to immediately fire up | | Apache the first time by running: | || | /usr/local/apache/bin/apachectl start || | Thanks for using Apache. The Apache Group| |http://www.apache.org/ | ++ [root@media apache_1.3.22]# popd /usr/local/src [root@media src]# /usr/local/apache/bin/apachectl configtest Syntax error on line 222 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: undefined symbol: uncompress -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] undefined symbol: compress during install?
On Monday, March 11, 2002, at 05:21 PM, Erik Price wrote: I just finished doing my re-install of PHP, updated to 4.1.2. Or so I thought... everything went smoothly, I got all the right success messages during the ./configure and make processes, and thought I was ready to go -- but as I confidently started up Apache, I was greeted with this message: [root@media src]# /usr/local/apache/bin/apachectl start Syntax error on line 222 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: undefined symbol: uncompress /usr/local/apache/bin/apachectl start: httpd could not be started Ho! I have just RTFG'd, which I wish I had done before posting. Looks like I have omitted the --with-zlib parameter in the ./configure of PHP. I had it last time b/c I was following a tutorial, and omitted it this time since I didn't think I needed it. Actually, I had no idea what the zlib did for PHP so I figured why bother. I just re-did everything, but this time I used --with-zlib, and it's fine. Hope this helps someone else in the future -- and for anyone else who wants a fully-documented, commented log of an upgrade from PHP 4.1.0 to PHP4.1.2, contact me. (I did it with PHP as a static module to apache, and the following config options: --with-mysql, --with-xmlrpc, --enable-sockets, --with-zlib) Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A silly question. :P
On Thursday, March 7, 2002, at 11:50 PM, GENESiS DESiGNS wrote: I would like to know why you put this character (!) in front of this: Nearly unanimously to all programming languages, the bang (!) symbol indicates not or negative or inverse or not true. So you use it when you want to indicate that something is not the case or if you are performing a test for the lack of a condition rather than the condition itself. Like this: if ($var) { echo Yes, var exists; } elseif (!$var) { echo No, there is no variable called var; } else { echo You cannot reach this part of the if statement. Either var exists or it doesn't; } (!(Hope that doesn't help)), Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] BIG PROBLEm with headers
On Friday, March 8, 2002, at 01:06 PM, Analysis Solutions wrote: I have problem with downloading any file from my site using IE 5.5 and HTTPS protocol. My php script works fine with Netscape 6.2 and HTTP/HTTPS protocols and with IE 5.5 but only with HTTP protocol. I suspect your script has nothing to do with it. A while back, I had problems serving my SSL'd pages to IE 5 users. If I recall correctly, it turned out to be a bug in IE not being able to process certificiates with key lengths that were not the ones expected. Thawte or my ISP inadvertently used a 1028 bit key on the certificate rather than 1024. IE5 has known problems with SSL. Some sites (sourceforge.net) use SSL only to authenticate the user, letting them back out of secure-mode after authentication succeeds, if the useragent is IE5. It reduces the potential for problems. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Again Session
On Friday, March 8, 2002, at 01:15 PM, Sven Jacobs wrote: Hey I have 2 values stored in my session, how do I pull them back out ? $_SESSION['name_of_first_value'] $_SESSION['name_of_second_value'] in PHP 4.1 or greater. And hay is for horses. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_id database
On Friday, March 8, 2002, at 01:12 PM, mailing list wrote: I am new to PHP so please excuse my ignorance. I want to manage and create session id's for my shopping cart with a MySQL database. I have a database with a session_id column that is auto-increminting. Is there any example of anyone using a mysql database to manage session_id's? No. http://google.com/search?hl=enq=session+management+php+mysql Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help needed with speading up a function.
On Friday, March 8, 2002, at 04:27 PM, George Whiffen wrote: Hope you are/are not trying to crack ciphers! George, you know way more about math than I do, but I do know that trying to crack them is a good way to make sure they work, or make them stronger! Erik (who thinks his pay rate should be a more rational number) Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php, text file, and mysql
On Thursday, March 7, 2002, at 04:30 PM, gregory hernandez wrote: i'm wondering if i can do the following: FIRST, using php, can i create/generate a text file on-the-fly (not saved to a server) THEN, insert the actual text file (and not its contents) into a mysql database. Sorry, but I don't really understand the question. If you are creating or generating a text file, the word file indicates that this is represented by an entity in a filesystem -- thus, it would be saved to a server. Are you asking if you can create/generate text without saving it as a file on the server, but rather just storing the text in memory temporarily? If so, then yes -- -- and the second question I haven't really figured out either. You want to store a text file into a MySQL database but not the contents of that file? It seems like in the first question you want to have contents without a file, and in the second you want a file without contents! :) Unless someone else figures out what you want and helps you, ask again but describe what you want a little bit more. PHP can do a lot of things. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rasmus, O'Reilly, Programming PHP
On Thursday, March 7, 2002, at 06:05 AM, DL Neil wrote: Rasmus/others, O'Reilly are advertising the imminent release (Mar 2002) of Programming PHP (http://www.oreilly.com/catalog/progphp/desc.html). Is that still going ahead? (I'll submit an advanced purchase order...) Hmmm... on the one hand, it's an O'Reilly book, and their books tend to shine pretty brightly (though I'm extremely fond of two of my New Riders books, MySQL by Paul DuBois and Python Web Programming by Steve Holden, very well-written and well-made books). But on the other hand, the writeup at O'Reilly that you link to doesn't really entice me -- it seems to offer the same topics as most other non-introductory PHP titles out there. I'd probably pick it up regardless, if only to demonstrate to O'Reilly that there's a demand for more books on PHP. To date, their PHP selection is pathetic. David, did you hear anything more about this? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mktime() into TIMESTAMP ?
On Wednesday, March 6, 2002, at 05:11 AM, DL Neil wrote: My 'rules' are simple: If the date/time is for processing, keep it as a timestamp (consider which type). If the timestamp is being used to keep track of RDBMS activity, then use a TIMESTAMP column. By RDBMS activity, do you mean last time user performed x query ? In fact, one of my columns is in fact designed to record things like last time user logged in or whatever, but I am not using the auto-bumping ability of the TIMESTAMP column, but rather creating a new INSERT statement and mysql_query() function to do this job. If RDBMS auto-update would foul things up, use an integer data type. If the date/time is for people/presentation, use a textural format. I'm thinking of not storing any plaintext dates, simply because it's easier to format the mktime() result or TIMESTAMP column to suit my needs. In fact, combining mktime() and date() really seem to be the way to go, which is why I'm using mktime()-generated Unix-style timestamps -- I'll probably never do any database output directly from mysql[client], but rather everything from PHP or perhaps Python if I ever get the time to work on that side project.* If there will be minor processing on the column, eg GROUP BY, ORDER BY, or even , =, etc, then use ISO format ISO = MySQL-style TIMESTAMP? If so, then can't you do ORDER BYs and , = queries with the Unix-style mktime()-generated integers as well? I'm not very experienced with the more advanced MySQL features, though I know they're there and have a decent reference should my script require them. If there will be no processing between what comes out of PHP and what PHP wants back, use a string format column. That's what I was thinking. Apart from some simple queries for results whose dates are between x and y (which should work with mktime()-generated timestamps, right?), it seems that this is the best policy. I should change those columns from TIMESTAMP to INT now before I go any further, just so that I don't accidentally ever bump up the value of the column via an insert or update... Yes you should remember that MySQL will happily cast between string and integer alternative presentations! I'm not sure I understand what this means. I'm guessing that you're suggesting that an INT or a VARCHAR column can both have mathematical operations performed on their values, but perhaps I'm completely off-base. My SQL skills are miserable... I need to brush up. (Too much time spent learning PHP lately!) Your take/critique welcomed! More like questions than critique! Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Add associative element to an an array
On Thursday, March 7, 2002, at 05:50 PM, Bradley Goldsmith wrote: Ive got an array of associations like this: [1]=2 [2]=3 [3]=4 etc I want to add a new element [8]=6. How do I do this? I have tried several ways: pushing the element, merging arrays, etc with no luck (it either increments the key or doesn't work at all). Have you tried just directly setting this array element? You don't say what your array is named, so I'll call it $array. $array[8] = 6; Is that what you are talking about? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php, text file, and mysql
On Thursday, March 7, 2002, at 07:16 PM, gregory hernandez wrote: can i insert the actual file (i.e. document.txt, of course with it contents) into a mysql? in other words, i don't want to read the contents of the file and insert the contents into a field in mysql. i want to insert the actual file into the database. is this possible? Yes you can, though it might be an inefficient way of doing it unless you have some reason to do it this way. Look into the column type BLOB (binary large object), it lets you store binary large objects, such as images or files or anything, really. Why inefficient? Well, for one thing, BLOBs don't retrieve as quickly as regular fields, for reasons I don't altogether know. Also, you won't be able to form a query to search for any characteristics of a BLOB, since MySQL will treat the BLOB as a BLOB and doesn't try to imagine what's inside it -- as opposed to, say, a VARCHAR column. There is also a TEXT column type for very long text strings, and I forget whether or not the contents of these can be used in queries -- can someone please confirm this? But basically, almost any other column type is valid subject matter for forming queries. But for storing images and PDFs or other binary data, there's no other way. Note that many MySQL wizards will recommend that instead of storing binary data in a database, use a filesystem to store the data and then use the database to create a sort of directory for quickly locating those files in the filesystem, remembering the path to the file or something. I think this is how a lot of web sites incorporate graphic content in with their database (text) content (including mine). Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rasmus, O'Reilly, Programming PHP
On Thursday, March 7, 2002, at 05:22 PM, Paul Roberts wrote: Amazon have it listed as folows. http://www.amazon.com/exec/obidos/ASIN/1565926102/qid=1015539436/sr=2-3/ref= sr_2_3/104-7882944-0058305 Hm. Too bad they don't have that read a sample chapter set up yet. That's a feature I don't usually use (there's a Barnes and Noble and a Borders near me if I want to read), but in this case would be nice. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session_start()
On Thursday, March 7, 2002, at 07:25 PM, Matthew Walker wrote: Do I have to place a session_start() function at the top of a page (.php) before the headers? When they say that you need to put session_start() before the headers, they're referring to the HTTP headers, not the head tag of the HTML document. HTTP headers are information about the document that tell the client what to expect as it receives the document -- this helps the client decide how best to handle the document. For instance, your client (web browser) might be configured to print any text files directly to the screen, but any XML files need to be parsed properly before being printed. Or perhaps you're not even being sent a document, but rather an MP3 or a PDF. Your browser might want to know a bit about the file that it is being served, before it goes ahead and displays the data on the screen -- in the case of an MP3 or PDF, it might wish to open up Windows media Player or Quicktime or Adobe Acrobat as a helper application (assuming your browser has been programmed to do this). You can learn more about HTTP headers here: http://www.jmarshall.com/easy/http/ NB I haven't read it, I just googled that (but I think I will read it later). Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a GoTo Page Function?
On Wednesday, March 6, 2002, at 01:10 AM, hugh danaher wrote: My wife knows I spend too much time in here. What's a wife? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a GoTo Page Function?
On Tuesday, March 5, 2002, at 07:56 PM, Andre Dubuc wrote: And thanks again! I like the 'function print_name_form()' -- I gather you could do this for all the NOT NULL variables that a form requires. Further, would you just change the print_name to 'print_whatever-other-variable' that I would want to check? Is there another way to consolidate the code at this point? Or would I just duplicate the code for each not-null variable? You can name a function whatever you want -- they're arbitrary, user-defined puppies. HOWEVER, the contents of a function need to do what you want -- the function that I showed you creates a very specific input, named name or something like that. So for each other input you want to create within a function, you'd have to make sure that they created unique inputs. Personally, I put all of my inputs into one function, and the function itself does both the error checking and the form-printing. This is probably not the cleanest way to do it, but it works -- in this case, the function is more of a subroutine than a proper function. (Subroutines and functions are more or less the same thing in PHP, there's no syntactic difference.) [Btw, I sometimes long for the old Paradox PAL code that seemed so difficult at the time I learnt it -- PHP is very similar, but the syntax seems so much more compact.] If you get to a point where you feel comfortable with PHP, you might consider investigating the Python language. It's got a very different feel, for instance you don't use bucks to indicate variable names, and there are braces around function definitions or if statements. Rather, you use whitespace to keep code chunks organized. Some people believe this is a more organized way to write code. Python is probably more apt for writing standalone programs and scripts, whereas PHP is more apt for writing web applications, but that's an opinion of mine and you can really use either language for either of those. www.python.org for more info. While we're on the topic of fields ('input type=text) is there anyway to include a non-printing space in the data entry, say for 'Name, that would not be passed to the database? Thus, on the screen it would appear: Name: [non-printing space]Andre but in the database entry: Name:Andre This isn't a pressing question, and probably is a formatting question, but I wonder if it's possible? Yes, a formatting/HTML question. I learned everything I needed to know about HTML from Sams Teach Yourself HTML/XHTML in 24 hours or from the web itself. That book was also super super easy. I'd say a little bit too easy if you're already learning things like PHP, which are a more advanced topic. I am not a very good designer, so I can't really answer your question directly, but I find that forms lend themselves well to being placed within HTML's tables. ?php print table trtdName:/tdtdinput type=\text\ name=\name\ //td/tr trtdPassword:/tdtdinput type=\password\ name=\password\ //td/tr trtdFavorite Sushi/tdtdselect name=\sushi\ option value=not badEbi/option option value=daringTako/option option value=wimpCalifornia/option /select/td/tr /table ; ? But when you see this in a web page, it is nicely formatted. Don't forget to customize the way the table looks by declaring borders and cell spacing in a style sheet. Also, as an exercise, come up with a clever way to put this code into a function. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php