Re: [PHP] ' giving problem while inserting in table.
Use addslashes() on ALL strings before inserting them into your database. Then, on your frontend, extract the data and use stripslashes() on all strings. Hope to help! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Anil Garg [EMAIL PROTECTED] 07/12/02 10:45AM Hi, I am making a faq maintenance system using mysql and php. To insert a entry in to a faq table i am using the following query: - INSERT INTO faq_table_netvd (id,question, answer,netvcr,netdetector,add_date,mod_date,keyword,category,display,attach_ id) VALUES ('0','$frm[question]', '$frm[answer]','$frm[netvcr]','$frm[netdetector]','$frm[add_date]','$frm[mod _date]','$frm[keyword]','$frm[category]','$frm[display]','$frm[attach_id]') ); --- now the problem is when $frm[question] has some string like: why i can't eat. i get the following error: MySQL Error: You have an error in your SQL syntax near 't eat?' ,answer = 'Please recheck the power of your specs:)' ' at line 3.Putting a '\' before ' (e.g. \')solves my problem...but when i open the same quesion to edit it, again i have to put backslashes where ever i find ' in the quesion or answer. Can anyone please suggest a solution to this. thanx and regards anil [please ask if i havent explained the problem fully] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Final Year Computer Science Project involving PHP
If completely developing a fully functional and optimized E-commerce site isn't good enough, I don't know what is. I can understand how it may not necessarily be innovative (though it could have innovative features), but designing such a site would prove to anyone I know that you have a great knowledge of the language the site was created in. As for original ideas, good luck. You'll come to find that anything you can think to do has already been done. You're best bet may be to look around some sites on the 'Net and try to vastly improve what has already been done. Projects that find solutions? That could be anything from a Weight Loss Tracking System to an advanced encryption/decryption algorithm. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Serdar Sokmen [EMAIL PROTECTED] 07/12/02 11:14AM Hi, Please read the rest of this email if you're interested in helping final year Computer Science student (yes, that's me...) by giving him some ideas on his final year project very possible involving PHP and SQL... I will start next autumn my third year of Computer Science studies. I have to carry out a large programming project in this final year. These projects are supervised and assessed via a dissertation and an oral presentation. The project alone counts for 20% of my whole degree, so it is quite important. A variety of project proposals have been made available for our consideration already but they all look very dull and boring. We are also encouraged to come up with our own project ideas. The onus is on us to define the problem boundaries, to investigate possible solutions, and to present the results verbally, in writing and (possibly) to demonstrate in action. They like having projects that find solutions (or improve a current sloution) real life problems. This summer, I am doing an internship in a Swiss IT company, working on a Content Management System implemented with PHP and MySQL. This will obviously give me some valuable experience with these languages (I sort of already learn them quite well...) and most of our tuition in Uni is based on Java. If you can think of an interestin final year project involving hese languages, it would be very kind to share it with me... In order to obtain a very high mark, the project needs to be challenging. For example, having an e-commerce web-site using a Database is seen as a weak, non-innovative project... Many Thanks for your time Serdar Sokmen [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
RE: [PHP] PHP meetup
I just signed up for this, as I would LOVE to be able to talk and interact (in person) with some PHP Developers. As I'm still learning (as we all are), it would be a great opportunity for me to be able to meet up and discuss this wonderful language with my peers. Hopefully that'll come to pass! :o) I emplore all PHP Developers to sign up for MEETUP. You have nothing to loose, and everything to gain! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Jay Blanchard [EMAIL PROTECTED] 07/12/02 11:48AM [snip] Want to meet other PHP developers in your area? Check out: http://php.meetup.com/ Pretty nifty idea... especially given the lack of user groups in the U.S. [/snip] I thought for others who had not seen this I would post this. There is probably already a user group in your area if you live near a major city. According to the PHPusergroups.org web site [http://www.phpusergroups.org/groups.phtml?menu=groups] there 189 PHP user groups in 52 countries. While there is nothing in my area (closest is Houston, over 3 hours away :^[ , and I thought there would be one in Austin, even if I don't want to drive an hour to go drink an adult beverage or two.) but you may find one already exists in your area. Meetup is a cool idea, and appears to be gaining ground slowly. Jon, did you cross-post to all PHP lists? Jay Code! Yes. A programmer's strength flows from code maintainability. But beware of Perl. Terse syntax... more than one way to do it...default variables. The dark side of code maintainability are they. Easily they flow, quick to join you when code you write. If once you start down the dark path, forever will it dominate your destiny, consume you it will. -- Yoda (or maybe Coda) -- 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] Form/insert problem
Below, is the code of a form to predict some matches. What I want is to submit this with with one button so it inserts the macthes in the database. One match is one record. The problem is that I don't know what to do now. Can someone help me with this form and the insert file (addvoorspelling.php) Thanks, Martin. ?PHP $today = date( Y-m-d H:i:s); include(auth.php); mysql_connect(., ..., ..); mysql_select_db (..); $sql = SELECT * FROM wedstrijden WHERE status='actief' AND datum '$today' ORDER BY datum; $resultaat = mysql_query($sql); $aantal = mysql_num_rows($resultaat); $i = 0; $queryr = SELECT * FROM ronde WHERE status='actief'; $resultr = MYSQL_QUERY($queryr) or die(mysql_error()); $aantalr = MYSQL_NUMROWS($resultr); $start = mysql_result($resultr,$r,start); $einde = mysql_result($resultr,$r,einde); PRINT link rel='stylesheet' href='centerstyle.css' body bgcolor=#f5f5f5 CENTER font size='5'From $start to $einde/fontp table tr td width=300bDatum/b/td td width=150bHome/b/td td width=50/td td width=150bAway/b/td td colspan=2bHT/b/td td colspan=2bFT/b/td td/td /tr; WHILE ($i $aantal): $id_wedstr = mysql_result($resultaat,$i,id_wedstr); $home = mysql_result($resultaat,$i,home); $away = mysql_result($resultaat,$i,away); $datum = mysql_result($resultaat,$i,datum); $sqlv = SELECT * FROM voorspelling WHERE id_user='$id' AND id_wedstrijd='$id_wedstr'; $resultaatv = mysql_query($sqlv); $aantalv = mysql_num_rows($resultaatv); IF ($aantalv == 0): PRINT form action=addvoorspelling.php method=POST tr td width=300$datum/td td width=150$home/td td width=50-/td td width=150$away/td td width=50select size'1' name='ht_home' option value='--'--/option; $j = 0; WHILE ($j 11): printoption value='$j'$j/option; $j++; ENDWHILE; PRINT /select/td td width=50select size'1' name='ht_aways' option value='--'--/option; $j = 0; WHILE ($j 11): printoption value='$j'$j/option; $j++; ENDWHILE; PRINT /select/td td width=50select size'1' name='ft_home' option value='--'--/option; $j = 0; WHILE ($j 11): printoption value='$j'$j/option; $j++; ENDWHILE; PRINT /select/td td width=50select size'1' name='ft_away' option value='--'--/option; $j = 0; WHILE ($j 11): printoption value='$j'$j/option; $j++; ENDWHILE; PRINT /select/td tdcenter input type=hidden value='$id' name=id input type=hidden value='$naam' name=naam input type=hidden value='$id_wedstr' name=id_wedstr input type=hidden value='$home' name=home input type=hidden value='$away' name=away /center/td /tr input type=submit Value=Verstuur! /form; ELSE: ENDIF; $i++; ENDWHILE; PRINT/table/CENTER; ?
RE: [PHP] IF inside LOOP?
try using this if statement instead if ($m $num_rows2 - 1) or even use the ?: operator echo ($m $num_rows2 - 1 ? , : .); -Original Message- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: Monday, July 15, 2002 12:04 PM To: PHP General List Subject: [PHP] IF inside LOOP? Hi all. I've been fooling around with a LOOP which should show one or more text string stored in separate rows in a DB. The trick would we to separate them with commas (,) when there's another string to show or end it with a period (.) if no other row is found according to the SELECT criteria. This is what I have so far: for ($m=0; $m$num_rows2; $m++) { $row2 = mysql_fetch_array($result2); echo $row2[devlanguage]; if ($m $num_rows2) { echo , ; } else { echo .; } } The problem is that the LOOP stops as it's told to do, keeping the ELSE statement from doing it's work, resulting in comma separated string as it should, but also add an extra comma at the end of it instead of a period. What approach should I use? Thanks in advance, mailto:[EMAIL PROTECTED] Cesar Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] BREAK into the DB
there's a function word_wrap() (or is it wordwrap(), something like that anyway) that'll help you there. -Original Message- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: Monday, July 15, 2002 3:00 PM To: 'PHP General List' Subject: [PHP] BREAK into the DB Hi all. I have this DB where I'm storing this sometimes large amount of text into a TEXT field, but I can't seem to find the way to BREAK lines so it won't make my browser go 3000 pixels wide when that text is printed. About this, I have two questions: 1) What should I use to break the text into lines at the DB so HTML can read them fine? and 2) How should I make the TEXT INPUT BOX so the visitor doesn't have to type br or something after 20 words or so? Is there a way that PHP can count and break text strings by itself prior storing? Thanks in advance, Cesar Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621 -- 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] Strange problem with apache 2.0.39/php 4.2.1/gd-lib
hello everybody, i'm trying to use php 4.2.1 with apache 2.0.39. i compiled php as dso, with gd support (libjpeg6b, libpng-1.2.3 , gdlib-1.8.4, freetype-2.1.2) compiling and installation of the above packages went fine, but when i start apache, i get the following message from the apache error log: 'PHP Warning: Unable to load dynamic library '/usr/local/lib/php/extensions/gd.so' - /usr/local/lib/php/extensions/gd.so: undefined symbol: gdImagePngCtx in Unknown on line 0' i tried several versions of gd-lib and libpng and recompiled php, but i always got the same error message. does anybody have an idea ? thanks in advance martin Martin Lucas - ICT Manager - TechConsult GmbH European IT-Marketing Research Am Platz der Deutschen Einheit Leipziger Str. 35-37 34125 Kassel FON: +49(0)561 - 8109 172 FAX: +49(0)561 - 8109 2972 mailto:[EMAIL PROTECTED] http://www.techconsult.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Good Forum...
Invision Board is the best PHP based BB that I've seen so far. If you're familiar with Ikonboard written in Perl, this is the same thing optimized for PHP. Not to mention that the installation is a BREEZE! You can get a copy FREE at http://www.invisionboard.com, and you can check out a sample of what it can do in the forums link below. Good Luck! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ [EMAIL PROTECTED] 07/15/02 06:26AM phpbb is a good forum or phorum both are free to use :) i hope you can use one of those ;) JJ Harrison\ writes: What is a good php-based forum? I would have used vBulletin but my group a non-profit so we obviously can't afford it. Part of what I require is users to be stored in a db table using md5() or anouther function. What I would do is expand the table with more user info for use with my whole site. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Alley-OOP! ... or not?
Hey all, I've seen quite a few programs that seem to greatly favor Object Orienting Programming (OOP) in their code. I don't mean to start a holy war or anything of the sort, but as a burgeoning PHP developer, I would like the opinions of my peers. So how about it, ladies and gents? Tell me about the Pros and Cons to OOP, and why you prefer to use it/not use it! Personally, I've always used regular functions to accomplish my repetetive tasks, and OOP seems rather daunting for me, but I'm always open to new (and hopefully, more efficient) ideas! Thanks! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie: mysql statement
You're right Andrew, got a little ahead of myself :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Andrew Brampton [EMAIL PROTECTED] 07/15/02 03:23PM Shouldn't this be UPDATE header SET parent='$this-parent' WHERE posted = max(posted) Otherwise the max(posted) = max(posted) is true for all records (therefore all records get updated) Andrew - Original Message - From: Martin Clifford [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, July 15, 2002 8:11 PM Subject: Re: [PHP] newbie: mysql statement I would rewrite the query as: UPDATE header SET parent='$this-parent' WHERE max(posted) = max(posted) -- 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] [PHP-DB] RE: PHP meetup [CROSS-POST] Meet other PHP Developersin Your Area
Yes, everyone please join up! I would love to find more developers in the Maryland area, and I'm sure others would in their areas as well! Let's do the great american get togeth... err... the great php get together! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Jay Blanchard [EMAIL PROTECTED] 07/15/02 03:20PM [snip] No, it's not a dating service :) Want to meet other PHP developers in your area? Check out: http://php.meetup.com/ Pretty nifty idea... especially given the lack of user groups in the U.S. I thought for others who had not seen this I would post this. There is probably already a user group in your area if you live near a major city. According to the PHPusergroups.org web site [http://www.phpusergroups.org/groups.phtml?menu=groups] there 189 PHP user groups in 52 countries. [/snip] I have seen some users groups mentioned, which is outstanding. PHP Meetup is gaining lots of ground with 105 members at last check. Top 5 cities are... Manhattan (below 42nd St) (5 members) London, England (4 members) Ann Arbor, MI (3 members) Melbourne (3 members) Washington DC (3 members) [actually tied with Philadelphia, PA and Orange County, CA] And I finally saw another San Antonio member. Just want to keep this fresh in everyone's mind. If you know of other developer lists where php is discussed please forward this along. Thanks! Jay Do not meddle in the affairs of dragons-for you are crunchy and good with ketchup -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ^k ? -- how do I match that?
Just try eregi_replace(\^k[.+], , $container); Regular expressions are the MASTERS of the INTARWEB! :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Jimmy Brake [EMAIL PROTECTED] 07/15/02 04:32PM Hi! I keep getting that evil little character ... ^k from mac users (pre X) and I need to remove it. Does anyone know how to remove? This site has that character as a vertical tab. This character is what is used in MS Excel when people hit return inside a cell. If they copy and paste that into a form its ok, but when I export that data to a csv it gets ugly. http://www.robelle.com/smugbook/ascii.html Thanks in advance! Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Free PHP Books in PDF or HTML Format
try out http://www.informit.com -Original Message- From: Chris Carlson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 11:54 AM To: [EMAIL PROTECTED] Subject: [PHP] Free PHP Books in PDF or HTML Format Hey guys, I was wondering if anyone on the list could recommend web sites to visit to find free PHP books available on the 'net in either PDF or HTML format. Thanks, CHRIS(.deletedscenes.org) -- 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] Get Anchor out of Url
Hello! I have a page which is called by: A HREF=/myfolder/mypage.php4?MyVar1=SomethingMyVar2=Someother#JumpHere Now I want to get the Anchor #JumpHere (which could be different each time) in mypage.php4. With PATH_INFO, I only get /myfolder/mypage.php4; With QUERY_STRING, I only get MyVar1=SomethingMyVar2=Someother With PhpInfo, I couldn't find any JumpHere. Any ideas how I can get the anchor in a php-page? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Submit code
I am looking for PHP code that will submit (post) a form automaically to a ANOTHER php page. I do not want to press a submit button. I have found a class at PHPClasses but it is too complicated for my needs. What is the simplest way of doing this? What is the theoretical approach? I think the only way to submit a form automatically is with JavaScript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Get Anchor out of Url
Oh, it seems, that only Netscape 4 is doing this wrong... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Classes vs. Functions
To add to the below, object classes, can have their own set of functions, called methods. These methods are specific to the function, and ALL functions within a class treat any properties (variables) within the class as global. So if you have a class Car with two properties (Make and Model), then those two properties can be readily accessible to any method within the class. At least I think that's how it works. I'm not all that knowledgeable on the subject :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Jay Blanchard [EMAIL PROTECTED] 07/16/02 10:51AM [snip] Could someone please explain the difference between classes and functions and how to use a class. I write alot of PHP, but I never understood this at all. I use an include statement in many of my pages and include a file with a bunch of functions. For instance, I might have a function called stock(); In the page I am using I include the file that has this function and I call it like this: stock($Sym); I am wondering if I am doing it the wrong way. So I need to better understand classes. What is one, and why would you use it? [/snip] A class is the representation of an object, such as a person, place, or thing. A function is a group of commands that can be called for a specific purpose. function addNumbers() A function can be performed on an object, but an object (the logical extension of class) cannot be performed on a function. Does that help? Jay Cleverly disguised as a responsible adult * * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/* * No developer is an island ... * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes vs. Functions
Here is a sample code (don't take this as gospel... Jay knows more about OOP than I do, I'm sure!): class Car { var $make; var $model; function setMake($x) { $this-make = $x; } function setModel($y) { $this-model = $y; } } $make and $model are the properties of the Car class, and setMake() and setModel() are the methods of the Car class. You don't actually get an object until make a *new* one. Like this: $passat = new Car; $passat-setMake(Volkswagen); $passat-setModel(Passat); This assigns the new object, passat, the properties relating to it's make and model, using the methods setMake and setModel. I'm sure this is right, but I'm sure I'm probably wrong (hehe, confused?). I'm also sure someone will correct me if I am! :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Chris Crane [EMAIL PROTECTED] 07/16/02 11:06AM It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. Jay Blanchard [EMAIL PROTECTED] wrote in message 000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt">news:000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt... [snip] Could someone please explain the difference between classes and functions and how to use a class. I write alot of PHP, but I never understood this at all. I use an include statement in many of my pages and include a file with a bunch of functions. For instance, I might have a function called stock(); In the page I am using I include the file that has this function and I call it like this: stock($Sym); I am wondering if I am doing it the wrong way. So I need to better understand classes. What is one, and why would you use it? [/snip] A class is the representation of an object, such as a person, place, or thing. A function is a group of commands that can be called for a specific purpose. function addNumbers() A function can be performed on an object, but an object (the logical extension of class) cannot be performed on a function. Does that help? Jay Cleverly disguised as a responsible adult * * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/* * No developer is an island ... * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes vs. Functions
I'm still trying to figure that out, but the fog is clearing slowly but steadily :o) From what I've heard on this and other lists, it's all a matter of preference. Obviously those that come from an object-oriented environment (Java, etc), will lean toward this method, while others stay with the procedural side of things (using functions). It's all a matter of preference, and just yet I haven't decided which is more useful :o) Good luck! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Chris Crane [EMAIL PROTECTED] 07/16/02 11:19AM This helps quite a bit Thank you. I am just wondering if I should make classes instead of functions? What would be the benefit of that? Do you know? Martin Clifford [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Here is a sample code (don't take this as gospel... Jay knows more about OOP than I do, I'm sure!): class Car { var $make; var $model; function setMake($x) { $this-make = $x; } function setModel($y) { $this-model = $y; } } $make and $model are the properties of the Car class, and setMake() and setModel() are the methods of the Car class. You don't actually get an object until make a *new* one. Like this: $passat = new Car; $passat-setMake(Volkswagen); $passat-setModel(Passat); This assigns the new object, passat, the properties relating to it's make and model, using the methods setMake and setModel. I'm sure this is right, but I'm sure I'm probably wrong (hehe, confused?). I'm also sure someone will correct me if I am! :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Chris Crane [EMAIL PROTECTED] 07/16/02 11:06AM It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. Jay Blanchard [EMAIL PROTECTED] wrote in message 000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt">news:000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt... [snip] Could someone please explain the difference between classes and functions and how to use a class. I write alot of PHP, but I never understood this at all. I use an include statement in many of my pages and include a file with a bunch of functions. For instance, I might have a function called stock(); In the page I am using I include the file that has this function and I call it like this: stock($Sym); I am wondering if I am doing it the wrong way. So I need to better understand classes. What is one, and why would you use it? [/snip] A class is the representation of an object, such as a person, place, or thing. A function is a group of commands that can be called for a specific purpose. function addNumbers() A function can be performed on an object, but an object (the logical extension of class) cannot be performed on a function. Does that help? Jay Cleverly disguised as a responsible adult * * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/* * No developer is an island ... * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange beahaviour with a mysql query in php
If you only want to update the row if it exists, then you need to use a WHERE clause to make sure it does exist. Blah blah blah WHERE row_id='$id' LIMIT 1 might work. I'm lazy and didn't want to retype what you had. :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ David D [EMAIL PROTECTED] 04/16/02 11:57AM Hello, I ve got mysql 4.0.1 I don't understand what happen. I use to make replace other than insert in order to avoid error in php scripts. I have a table with on primary key : CREATE TABLE `nlconfig` ( `id` tinyint(4) NOT NULL auto_increment, `nomnews` varchar(255) NOT NULL default '', `hebergeur` varchar(255) NOT NULL default '', `fromc` varchar(255) NOT NULL default '[EMAIL PROTECTED]', `fromonline` varchar(255) NOT NULL default 'contact', `limitconf` tinyint(2) NOT NULL default '7', `host` varchar(255) NOT NULL default 'localhost', `user` varchar(255) NOT NULL default 'root', `passwd` varchar(255) NOT NULL default '', `db` varchar(255) NOT NULL default 'newsfr', `tablenews` varchar(255) NOT NULL default 'news', `tabletemp` varchar(255) NOT NULL default 'temp', `tablelog` varchar(255) NOT NULL default 'log', `tableconfig` varchar(255) NOT NULL default 'nlconfig', `admin_pass` varchar(255) NOT NULL default 'pikatchu', `limitlog` tinyint(2) NOT NULL default '10', `url` varchar(255) NOT NULL default '', `pathtopmn` varchar(255) NOT NULL default 'http://www.test.fr/fr/', `langfile` varchar(255) NOT NULL default 'lang-french.php', `welcome_subj` varchar(255) NOT NULL default 'bienvenue', `welcome_msg` text NOT NULL, `sub_msg` text NOT NULL, `pied` tinytext NOT NULL, `validation` tinyint(1) NOT NULL default '1', `description` text, `newstemplate` varchar(100) default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM; When inserting with mysqlfront windows client : replace into nlconfig values (last_insert_id(),'abc', 'nexen', 'a@', 'a', '', 'localhost', 'root' , '', 'newsfr', 'news', 'temp', 'log', 'nlconfig', 'lucas', '', '', 'http://www.test.fr/fr/', 'lang-french.php', '','','','', '1','','' ); 1st on row affected 2nd 2rows. I get no error. But from a php 4.06 script I get : errno 1062: erromsg : Duplicata du champ '127' pour la clef 1 That means : duplicate value for key 1. I didnt have the same result from a php script ? That the same error i get with NULL in the id with the windows client ?! Could you explain me what happen ? I only want to insert a new row when values are different from what is on the table, and to replace the row that there is when there is the same id or when all the data in query is the same ! Is it for that, that replace is for ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exit script early
RTFM re: Exit and Continue. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Michael Zornek [EMAIL PROTECTED] 07/16/02 01:08PM Ok, So I'm creating a details.php page where I'm expecting the url to be something like: /details.php?id=12345 Thus in my php I have the following: if (!isset($id)) { // if no id exsits // Create a page saying ID not found, goto index writeHTMLTag(); writeHeader(Error, never); writeBodyTag(); writeLogoNav(); echo h1Error: A hospital ID was not found./h1 pGoto: a href=\index.php\Nursing Career Match/a ; writeFooter(); writeHTMLTagCloser(); // what command can I use to end the script right here? } else { // Run MySQL stuff and display page } My question is what command can I use to end the script [inside the top part of that if statement]? ~ Mike -- Mike Zornek | Project Leader Apple Student Developers The Insanely Great Site with the Insanely Long URL http://www.applestudentdevelopers.org Personal Site: http://www.mikezornek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I can't echo object variables
Try enclosing it in curly braces. echo p${db-field('name_long')}; Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Michael Zornek [EMAIL PROTECTED] 07/16/02 01:45PM We all know this works: echo p$someVar; However this does not: echo p$db-field('name_long'); I know this slight variation will make it work: echo p . $db-field('name_long'); But it's cumbersome .. Anyway to get the first way to work? ~ Mike -- Mike Zornek | Project Leader Apple Student Developers The Insanely Great Site with the Insanely Long URL http://www.applestudentdevelopers.org Personal Site: http://www.mikezornek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way?
It's called here doc formatting, and follows the pattern below: $chunk = EOF; // stuff here EOF; Hmm. For some reason that just doesn't look right. I'm sure someone will correct it if I'm wrong though :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Chris Crane [EMAIL PROTECTED] 07/16/02 02:03PM In Perl you could print a block of information as it was written like this; print HTML_END; This a whole bunch of HTML code!!! HTML_END The best part about this, was that you did not have to escape your and you could mix in your variables making it easy to design and layout the HTML. Is there a similiar way to do this in PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session and output buffering
You have to give the variable value before registering it, from my experience. $var = 123 Sesame Street; session_register($var); Also, I don't believe you need to use session_unset(), since you are already destroying the session information. If you are getting errors, it would be helpful if you include those in your message so that we might be able to deduce the error from it's cryptic nature :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Divyank Turakhia [EMAIL PROTECTED] 07/16/02 02:46PM I have set output_buffering = On in my php.ini file, since I need this for my application. When the user logins I want to destroy any current session and start a new session. I have included the below in my code for the same. But for some reason all my old data is available in the session. session_start(); session_unset(); session_destroy(); session_start(); session_register(somevariable); Can anyone figure out where I may be going wrong. Warm Regards, Divyank Turakhia -- http://www.directi.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question on Efficiency
Unless the file is getting retartedly big (10-20K), then I wouldn't separate them. Though if you have enough functions, you could justify making separate files for your database functions, output functions, backend functions, etc. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ [EMAIL PROTECTED] 07/16/02 04:59PM Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Classes vs. Functions
Martin Clifford wrote: Could someone please explain the difference between classes and functions and how to use a class. Whether you should like OOP or not is a religious matter, so I will not enter the field. OOP has its pluses and its minuses. It's a technique, not an ultimate truth, although it is often presented as such. And as any technique, it can do wonders and it can do plain bull**t when not properly used. Nowadays 100% of my work is OOP based, but I worked some 15 years on functions and I cannot blame those who keep working that way. There are reasons for doing it and reason for not to do it. Get yourself a good clear book, then make a decision. [snip] I have to agree here. IMO, there are benefits in using classes over functions, and there's benefits in using functions over classes. Once you get to know oop a little better, you should be able to determine which is better is any given situation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Printer margins
You can't change this type of setting on a client's browser The only way you'd be able to do this is to tell the user that the page prints best when margins are set to 0.25 -Original Message- From: Manuel [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 10:52 AM To: PHP General Subject: [PHP] Printer margins I'm creating an HTML file that will be printed by my website users. I've notices that most browser have the default print margins set to 0.75. Is there any way to change the print margins to 0.25? - Do You Yahoo!? Yahoo! Autos - Get free new car price quotes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Classes vs. Functions
[snip] A CLASS after all is just a collection of functions with a data model. But ... there is modular and then there is OO imho. [snip] A class is more than just a bunch of functions that have been placed together. If you want to do that, then you might as well just throw them all into the same include file and that's it. There's no added benefit in wrapping a class around them. Agreed, a class can be used to simulate the C-style struct, or to collect a bunch of functions, but the real power of classes is when you start to model the real world objects (ie, methods and properties, not just functions and variables.) I'm not saying to go all OO (or all procedule, I use both...), just that when used correctly, they can be really helpful. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
The only reason a compiled language would not include a function/module/etc is to reduce the size of the final executable. Since php doesn't store (barring the caching engines, but they work differently anyway) a compiled version, it doesn't need to worry about not including something. Martin -Original Message- From: Michael Kennedy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question Yeah, that's what I figured. With C++ you could find evidence that it only grabbed the used portions, but in PHP I didn't see anything to support that. Of course, like I said, the answer likely wouldn't have made a difference in anything I did, but it's nice to delve a little deeper sometimes. Thanks. Michael -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 8:05 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... -Original Message- From: Michael Kennedy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 7:26 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question OK, if I understand C++ correctly, if I write a program and #include iostream.h or something similar and compile the program it only compiles with the used functions in it, right? So, if I never use 'cin' it leaves that function out of the final complied app. Does/can PHP do anything similar? I'm always much more comfortable with a language when I can understand how it works and I'm sure some of you feel the same. Now, I fully understand that PHP documents are not even close to being compiled in the traditional sense. But, I'm wondering if it pulls all the necessary functions into memory when the page is accessed, then uses them when needed, or does it pull the whole include()d file into memory and just combine the whole mess together into one big memory heap and run like that? My gut tells me that it's the second one, but I'm just wanting to be sure. Of course, the answer likely won't make a single difference in my life, but I'm just curious... Also, I hope the above question isn't stupid. I do have a habit of thinking about something for a while and then having it suddenly hit me later that the answer is simple very trivial. Ah, well... Thanks for humoring me. Michael -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 5:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question on Efficiency If you have have a large number of functions, it might be better to separate them into a few files that you can include as needed. I use one file that contains functions needed by every page. I have a few other files that contain functions that aren't needed by every page, so, I include them only on pages that need them. But most functions go in the main include file used on every page. Separating them will also minimize some overhead if you have a lot of functions. Otherwise, if your include files aren't War Peace in length, one include file is fine. [EMAIL PROTECTED] 07/16/02 04:59PM Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Bug in PHP?
check that the gaps between the domains are really spaces eg: echo ord($HTTP_POST_VARS[domains]{11}); I did this through a test script: ? $HTTP_POST_VARS[domains] = www.php.net www.jokaroo.com www.gnu.org; $site = explode( ,$HTTP_POST_VARS[domains]); print_r($site); exit; ? and got this as the output Array ( [0] = www.php.net [1] = www.jokaroo.com [2] = www.gnu.org ) But the email program (yours or mine) might be converting the gap to spaces... (??) -Original Message- From: Aleks D. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 5:35 PM To: [EMAIL PROTECTED] Subject: [PHP] Bug in PHP? Hello, I'm trying to explode an associative array element in $HTTP_POST_VARS retrieved from submitting am html form. The URL to the form is: http://www.funfry.com/form.html Now when I try to explode $HTTP_POST_VARS[domains] it doesn't seem to have the desired effect. I use the syntax $site = explode( ,$HTTP_POST_VARS[domains]); and instead of the expected result of: $site[0] = www.php.net; $site[1] = www.jokaroo.com; $site[2] = www.gnu.org; I get: $site[0] = www.php.net www.jokaroo.com www.gnu.org; The value of $HTTP_POST_VARS[domains] after submitting the form is www.php.net www.jokaroo.com www.gnu.org. Does anyone have an idea of how I can get each domain in a seperate array index? regards, Aleks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_SESSION_VARS ? Have I got it wrong
Define the value of $count before registering it, and it should work fine :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Henry [EMAIL PROTECTED] 07/17/02 10:14AM The answer is probably yes. I do a session_start() followed by a $HTTP_SESSION_VARS['count']=2 on one page. Then I go to another page and do a session_start() again; unfortunately the $HTTP_SESSION_VARS['count'] is empty!!! I tried doing a session_register('count2'); $count2=123; in the first page followed by another page where I display $count2 and that works fine. Why? Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_SESSION_VARS ? Have I got it wrong
Ignore that, I'll just go grab my copy of Hooked on Phonics so I can learn to read before replying. :trots off: Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Martin Clifford [EMAIL PROTECTED] 07/17/02 10:15AM Define the value of $count before registering it, and it should work fine :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Henry [EMAIL PROTECTED] 07/17/02 10:14AM The answer is probably yes. I do a session_start() followed by a $HTTP_SESSION_VARS['count']=2 on one page. Then I go to another page and do a session_start() again; unfortunately the $HTTP_SESSION_VARS['count'] is empty!!! I tried doing a session_register('count2'); $count2=123; in the first page followed by another page where I display $count2 and that works fine. Why? Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] querying for one specific row number
If you are using an auto_increment primary key field named id, then you would use this: SELECT * FROM table WHERE id=2 LIMIT 1 Just so long as you know that if for some reason you delete that row, there will NEVER Be another id of 2, unless you set it that way. If you only want to select certain columns from the row, then list those columns in place of the wildcard. SELECT first_name, last_name FROM table WHERE id=1 LIMIT 1 HTH! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Phil Schwarzmann [EMAIL PROTECTED] 07/17/02 10:21AM I want query my mysql table and get one particular row. So let's say my table had 5 rows (entries) in it, and I want to pull just row #2, how would I do this?? THANKS!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Of Jobs and Certs
Howdy everyone, I'd like to get everyone's input on Jobs and Certs. I know there are a couple Certifications for web developers out there, such as the CIW and CWP certifications. Here are my questions: 1. What is the best method to go about becoming certified? 2. What is the best way to go about getting into the web development industry? 3. If you have ever taken online courses relating to web development, what is your opinion on them? Good, bad, ugly? 4. Which certification is most beneficial? I know that CWP requires work experience before becoming certified past certain points, and CIW does not require this. 5. Why can't I remember what question five was? Doh. At any rate, I'm current a data entry clerk, but have quite a bit of web experience (none at a job, though), and I know that I have TONS more to learn, but I am very passionate about it and want to be able to do it as a career. I just don't know where the hell to start, and I know that some of you might be able to offer some advice in this area. Thanks in advance! This is very important to me, so I thought I'd ask the people that would know best :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION - autostart, or session_start() ?
The error is pretty self-explanatory. You aren't starting the session before soemthing is being written to the page. This will yeild the same error: -top of document-- !-- BEGIN DOCUMENT ?php session_start(); ? -botton of doc- This is because something has been sent to the browser (the comment line), which is after the HTTP headers have already returned from the server. HTH Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Matt Babineau [EMAIL PROTECTED] 07/17/02 11:20AM If I set the SESSION autostart = 1 in the PHP config, would that eliminate my need to use session_start() in my code? I have some PHP inline with some HTML, and the PHP is telling me: Warning: Cannot send session cookie - headers already sent Any ideas how to remedy this? Matt Babineau MCWD / CCFD - e: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] p: 603.943.4237 w: http://www.criticalcode.com/ http://www.criticalcode.com PO BOX 601 Manchester, NH 03105 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to access javascipt variables in PHP
You can blend the two... sort of. script language=javascript !-- hide me function checkWidth() { var width = screen.width; var height = screen.height; document.location = filename.php?width= + width + height= + height; } //-- /script body onload=checkWidth(); I'm not aware of any PHP vars that hold screen information. HTH Martin Seppo Laukkanen [EMAIL PROTECTED] 07/17/02 03:06PM Can anybody help? I have javascript code to find out browsers width and height, but they are stored in javascript variables. How can I access them from PHP? Or is there a method to do same in PHP straightly? Thanks, Seppo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Includes vs. Functions
Chris, thanks for describing your method. The reason I really dislike Functions in PHP is because you have to pass every variable needed by a function, even if that variable is global in the main script, which is a pain in the ass when a function needs a long string of variables. It makes it easier to forget a variable in the list and can make the code look messy. [snip] The whole idea behind modularization is that you are creating a black box so to speak, a chunk of code that performs one function, and one function only. It should present a *minimal* interface to the outside world. This means that if I have a black box that say, gives me the current local time in a particular timezone, I should be able to feed it the name of the timezone, and it should give me back the current time. I should NOT have to know how it works inside, or care. I feed it one value, and it returns another value. [snip] To add to this. If you're passing too many values to a function, then maybe that function isn't broken down enough. I remember hearing/reading that if you need to pass more than, I think, 5 or 6 values to a function, then you're passing too many. Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check for Associative Array
Try this: while($row = mysql_fetch_assoc($result)) { // code here } This way, the resulting array will ONLY be associative. HTH! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Henning Sittler [EMAIL PROTECTED] 07/18/02 12:57PM What's the best way to check for an Associative Array? There is no is_assoc() or similiar function listed in the manual (I don't think anyway). I'm using mysql_fetch_array() and I want to foreach only the assoc. part of the array without using mysql_fetch_assoc(): foreach ($arr as $key=$value) { echo $key:$value; } But of course it show both the indexed array and the assoc array contents. Is there an existing function to check this, or should I do one of these things inside the foreach loop: A) set $last=value and just check if $value = $lastval B) check if the $key is just a number or just a string C) $key += 1 ?? Thanks, Henning Sittler www.inscriber.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check for Associative Array
Oh well. And HTH means Hope to Help. For some unknown reason the OP specifically does not want to use mysql_fetch_assoc()! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] spawning scripts to different graphical targets
I would assume you just do it as if you didn't have any scripts in it in the first place. The link in frame A might be like below: a href=content.php?show=TOC target=bClick here to see the content/a Then, in frame b, content.php will show up and you can then use $show to decide what to do. I might be totally off on this one, but I only went on what it sounded like you wanted. The same applies to JavaScript. // This can be used to get the height and width of the browser window for any server-side needs. script language=javascript !-- hide me function getScreen() { var height = screen.height; var width = screen.width; document.location = index.php?height= + height + width= + width; } body onload=getScreen(); :babbles on and on and on...: Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Alberto Serra [EMAIL PROTECTED] 07/18/02 03:12PM ??! Is there a way I can decide where to target my output from server side? suppose my page has two iframes +---++---+ ! A !! b ! +---++---+ while executing a script that is called by A can I spawn another script that will output to b? And no, I cant' use any Jscript, but I do know from server side what my target names are (A and b, that is). Bear in mind that A and b might be even different windows, but I'd more than happy even if it worked with iframes on a single window. @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- 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] Arrays and Regs
Howdy, Just a performance question, if anyone knows for sure. Within a large array, would using numerical indices be quicker than associative? I'm talking about a *noticeable* difference in performance, here. Also, on Regular Expression replacements: $text = eregi_replace(([abc]+), span style=\color: red\\\1/span, $text); Would this replace any occurences of the pattern with the same pattern match in red text? I'm not sure exactly how the \\1, \\2, etc. works. So, does: $text = eregi_replace((a)(b)(c), \\1, $text); Does this output only the 'a'? I find this confusing for some reason, hehe. Any help would be great! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Please Help with LOOP!!
Asmodean - using comma is another way of using echo... Wee - try this instead - you're putting two loops together when you don't need to for($count=1; $count=$rows; $count++) { $query_data = mysql_fetch_array($result); $price = $query_data[price_lq]; $RowColor = useColor(); // current echo statements here } or $count=1; while($query_data = mysql_fetch_array($result)) { $price = $query_data[price_lq]; $RowColor = useColor(); // current echo statements here } $count++; -Original Message- From: Asmodean [mailto:[EMAIL PROTECTED]] Sent: Friday, July 19, 2002 10:48 AM To: PHP General Subject: Re: [PHP] Please Help with LOOP!! Hello Wee, Friday, July 19, 2002, 2:36:40 AM, you wrote: WK Hi all... WK I'm a complete beginner in programming. Just started a few months ago. WK So, I'm sorry if this is a stupid question to ask. But I'm at a dead end here and do not know where else to go. WK I'm trying to automate a checkbox name to have the name choice1 to have incremental effect on the number such as the following: WK input type=checkbox name=choice1 value=x WK input type=checkbox name=choice2 value=x WK input type=checkbox name=choice3 value=x WK ... WK And I used the following script (please don't laugh) :) WK Maximise this email to full screen so that you can see the script better. WK for($count=1; $count=$rows; $count++) { WKwhile($query_data = mysql_fetch_array($result)) { WK $price = $query_data[price_lq]; WK $RowColor = useColor(); WK echo TR BGCOLOR=\$RowColor\\n; WK echo TD width=\10%\ valign=\top\font size=\2\ face=\Arial, Helvetica, sans-serif\,$query_data[prod_brand],BR/FONT/TD; WK echo TD width=\60%\ valign=\top\font size=\2\ face=\Arial, Helvetica, sans-serif\,$query_data[prod_desc],BR/FONT/TD; WK echo TD width=\15%\ valign=\top\font size=\2\ face=\Arial, Helvetica, sans-serif\,$,$price,BR/FONT/TD; WK echo TD width=\15%\ valign=\top\input type=\checkbox\ name=\choice,$count,\ value=\, $query_data[prod_id],\/TD\n/TR; WK} WK } WK The result was irritating... it came up with the same name, which is choice1 all the way like: WK input type=checkbox name=choice1 value=x WK input type=checkbox name=choice1 value=x WK input type=checkbox name=choice1 value=x WK ... WK Am I doing it the wrong way? If so, how should I do it? WK Please pleas help... thanks WK Yours, WK Wee Keat WK WK Good timber does not grow with ease; the stronger the wind, the stronger the trees. echo TD width=\15%\ valign=\top\input type=\checkbox\ name=\choice,$count,\ value=\, $query_data[prod_id],\/TD\n/TR; Your problem is with this line. Look closely at the following part: name=\choice,$count,\ You should do this: name=\choice . $count . \ ... and it will generate names like 'choice1', 'choice2', and so on. -- Best regards, Asmodeanmailto:[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
RE: [PHP] vertical word match
try changing the +'s with *'s + = 1 or more * = 0 or more -Original Message- From: Joe Rice [mailto:[EMAIL PROTECTED]] Sent: Friday, July 19, 2002 3:30 PM To: [EMAIL PROTECTED] Subject: [PHP] vertical word match hello, any regex gurus? i'm trying to match words put into a textarea that are in the form of a\np\np\l\e or any combination of new lines in between, before or after. $answer = hello\na\np\np\nl\ne\n; /*from textarea in form*/ $word = apple; $word = preg_replace(/(.)/,(.?|\s+|\n+|)$1(.?|\s+|\n+|),$word); preg_match(/.$word./im,$answer,$match) works. but if $word = red apple; $answer = r\ne\nd\n\na\np\np\nl\e; it doesn't match. thanks in advance, joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sorting array based on key string
dunno if this'll work... but here goes... sort($data); ksort($data); but ksort() might mangle the order from sort(). In that case, you'll need to write your sort routine that retains the old order -Original Message- From: Peter J. Pieczora [mailto:[EMAIL PROTECTED]] Sent: Friday, July 19, 2002 5:35 AM To: [EMAIL PROTECTED] Subject: [PHP] Sorting array based on key string Pardon my sloppy explanation but here it is: how can i sort an array based on key element ie. key values are: a1, a2 ,a3 ..., b1, b2 ,b3, ...c1, c1, c3... so doing this: while (list($k, $v) = each($data)) { for ($i=0; $icount($k); $i++) { echo $k[0] = $v\nbr; } will list all the $k $v . a = foo a = bar b = another foo ... and so on Now, how can i sort it according to $k[0] where $k[0] = a, than the same for all b's and so on. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] best way to delete char# 4-7 from a string?
dunno how much slower it'd be, but it might look better. You could convert the strings to an array, use array_splice(), and then convert back to a string. -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Friday, July 19, 2002 3:39 PM To: php Subject: [PHP] best way to delete char# 4-7 from a string? Hi, Let's say I have the following string: $str = 'abcdefghijklmnop'; ...and I want to strip out char #'s 4 through to 7 (d,e,f,g) $strip_start = 4; $strip_end = 7; ($str would now be 'abchijklmnop';) THEN I want to plug a new string $filler at position 4 $filler = '4567'; ($str would now be 'abc4567hijklmnop') This is what I think would work (untested), looking for pointers, optimisation, or a better approach: ? $str = 'abcdefghijklmnop'; $strip_start = 4; $strip_end = 7; $filler = '4567'; $pre = substr($str,0,$strip_start-1);// abc $post = substr($str,$strip_end+1,strlen($str)); // hijklmnop $str = $pre.$filler.$post; //abc4567hijklmnop ? Thanks, Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Arrays and Regs
Firstly, many thanks to Richard and Dan... A quick test script in PHP would have been faster than asking... :-) It was just one of those questions that I had burning in my mind at the time, and since I don't have access to PHP at work (As if the Government would allow that!), I had to ask :o) And to Dan: I would love to change the line margins of my email client, but unfortunately Novell Groupwise sucks, and the government will not, without exception, allow customization of any software, whatsoever. So I'm stuck with it. Thanks again guys! Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hex Help Please...
Doesn't look like anyone has replied to you on the php-general mailing list. Have a look at this page http://www.wotsit.org/search.asp?s=graphics some of the docs there might help you HTH Martin -Original Message- From: Georgie Casey [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 6:16 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Hex Help Please... Rite, There's a PHP script that takes a monochrome BMP and converts it into some sort of hex code and I've noticed some patterns with this code. This image is 72 pixels wide by 14 high so there's 1008 pixels. In the code returned, theres 252 chars, which is 1008 divided by 4. So I guessed the image is split into 4 pixels each. So if I pass an image with the first pixel black and everyhting else white, it returns 8 for those 4. If I pass an image with the first and second black, it returns c. With the first three black, it returns e. With the first 4, f. And if I have the 5th pixel black it goes onto the next char code, eg returning f for the first 4 pixels, then 8 for the 5th pixel black, ie the first pixel in the next 4. In total it returns f8. PS I tried reading in each pixel of the script, checking if it was black or white, 1 for black, 0 for white. Then converting these 0s and 1s from decimal to hex, then converting from binary to hex, but to no avail. Then I tried taking a set of 4 1s or 0s and converting them, but still no luck. So my questions is, does anyone know how theyre encoding the image I could probably could decipher the coding with some experimentation but it really looks like hex and I might be wasting my time. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] automatic credit card processing
either use curl, and set to option to return the results to you to on or use ob_start(), ob_get_contents(), etc -Original Message- From: Dominic [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:11 PM To: [EMAIL PROTECTED] Subject: [PHP] automatic credit card processing Hi all I try to automatically process cc payment. I use online clearing via a third party -- so what I have to do: 1. SSL-TCP/IP connection to this third party-server 2. perform basic http authentication 3. send authorization request parameters to the software (via POST or GET) 4. receive + parse authorization response 1-3 is not a real problem, but how can I receive the response, before it is printed out to the browser/screen? I know I should get the response string into a variable so the whole procedure is silent, but how? thanks a lot for every little help! cheers dominic -- dominic brander dominic brander - snowflake productions gmbh - http://www.snowflake.ch tel. 01 451 75 71 - fax. 01 451 63 80 - mobile 076 543 17 94 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] separated string by comas
$string = str_replace( , ,, $string); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:57 PM To: php-general Subject: [PHP] separated string by comas I have a string that is separated by spaces like this $string=test test1 test2 test3; how can I make the string so it is separated by comas like this $string=test,test1,test2,test3; I know this is probably simple but I just can't figure it out -- Best regards, rdkurth mailto:[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] Re: Using Javascript
Just my opinion, but it is ALWAYS a good idea to terminate statements with semicolons, no matter if there is or isn't additional statements. But thanks Chris for at least using standardized HTML coding practices. I can't stand it when I see tags and the like that don't cooperate with standards. Martin Chris Earle [EMAIL PROTECTED] 07/22/02 01:18AM You use the onClick feature like this: input type=text name=text1 onClick=dd.value='? echo $correct; ?' no semicolon unless there is more than one thing being called/defined -- you use single quotes within the onClick's double quotes Uma Shankari T. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I need to display a value on the text box during onClick event where the data is fetched from the database..I have given the code like this but it is giving unterminated string constant.. input type=text name=text1 onClick=(dd.value=? echo $correct; ?); Can anyone please tell me how to solve this ... Thanks Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie's question about \n
Think of it this way: br creates a line break in HTML Output, \n creates a line break in HTML Code. echo I really\n like\n PHP!; HTML Code: I really like PHP! HTML Output: I really like PHP! HTH It seems that i have a very silly problem. I can't get the new line escape character to work. the following is my SIMPLE script and corresponding output. PHP script: -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; echo this should be printed out:\n; echo this is a second line; ? Output in IE6: this should be printed out: this is a second line regards, KK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do You Yahoo!? Yahoo! Health - Feel better, live better Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What does register_globals do?
My way of thinking about is: With register_globals ON, all variables defined are available anywhere in the script (with the exception of functions and classes, unless defined otherwise), whereas with register_globals OFF, they are only available through the superglobals for the respective variable types. I'm sure there's a much better way to explain it, but it works for me :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Matt Babineau [EMAIL PROTECTED] 07/22/02 03:59PM I have never had a clear understanding about what this does, the php.ini has an explanation but being newer to PHP I don't understand it very well. Could someone prodive a human explanation about what register_globals does and why it is so important? Matt Babineau MCWD / CCFD - e: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] p: 603.943.4237 w: http://www.criticalcode.com/ http://www.criticalcode.com PO BOX 601 Manchester, NH 03105 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What does register_globals do?
unless defined otherwise was what I said. When I said that, I simply meant that you declare the variables as global within the function and/or class. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Matt Schroebel [EMAIL PROTECTED] 07/22/02 04:41PM From: Martin Clifford [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:21 PM Subject: Re: [PHP] What does register_globals do? My way of thinking about is: With register_globals ON, all variables defined are available anywhere in the script (with the exception of functions and classes, unless defined otherwise), whereas with register_globals OFF, they are only available through the superglobals for the respective variable types. That's not quite right. Php's variable scoping is different than most langauges. Variables inside a function are always local, even with register_globals on (this has something to do with Rasmus' life experiences at IBM). So you would need to use global on a variable inside a function (unless it's passed in) and except for the 'magic' global arrays, $_POST, $_GET, $_COOKIE, $_SERVER, etc --- register_globals on -- http://localhost/index.php?target=help ?php function echo_out() { global $target; echo $targetbr; } echo_out(); ? --- register_globals off -- http://localhost/index.php?target=help ?php function echo_out() { echo {$_GET['target']}br; } echo_out(); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comma question
I remember from a previous post, the dot operator will create a temporary string in memory, and then echo that out. The comma operator will just output as it goes - ie. it doesn't create a temporary string. As for Lee Doolan's reply: echo trtd{$obj-strName[$i]}/td/tr; interesting - never thought of doing that, I alway's broke out of the quotes to do object dereferencing. Should make my future code more readable I think... Martin -Original Message- From: B i g D o g [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 9:06 AM To: PHP GEN Subject: Re: [PHP] Comma question Thanks all for the info... I figured that the comma was to concatenate but is was wondering if the parser handled it different. I knew the {} helped the parser now which was the variable...but i have never seen it like that... I have only seen it like ${var}... Just wondering the difference... .: B i g D o G :. - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: B i g D o g [EMAIL PROTECTED]; PHP GEN [EMAIL PROTECTED] Sent: Monday, July 22, 2002 5:00 PM Subject: Re: [PHP] Comma question Curly braces {} are sometimes required for PHP to properly parse variables within quoted strings. Good example might be defining variable-variables within a quoted string ${$myvarvar}. However I do not believe that curly braces are required in this particular string. As for the comma I believe it does the same thing as the period. It will concatonate the quoted string with the output of the htmlspecialchars() function within the echo statement. -Kevin - Original Message - From: B i g D o g [EMAIL PROTECTED] To: PHP GEN [EMAIL PROTECTED] Sent: Monday, July 22, 2002 4:34 PM Subject: [PHP] Comma question Tried to check the archive, but it is offline... What does the , and {} do in this type of statement? Example: echo trtd{$strName}/td/tr, htmlspecialchars( $teststr ); Thanks, .: B i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Formating datevariables...
As Demitrious said, use mysql to do it. But if you want to use php, just use substr(), since all the numbers are there, there's no point converting to unix time, just to convert it back again... unless you're going to do some maths of it -Original Message- From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 9:51 AM To: 'Ragnar'; [EMAIL PROTECTED] Subject: RE: [PHP] Formating datevariables... Why not let mysql do it? It has a function do to exactly that, I think... But php's date() is the function you're looking for... -Original Message- From: Ragnar [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Formating datevariables... I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? Thanx -R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with Not displaying HTML if data not found
what about if (strlen($result[FLRPLAN_3]) 0) -Original Message- From: markbm [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 2:02 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem with Not displaying HTML if data not found I am trying to develop a page that, in certain places, I only want it to display the TR and TDs if data is found for a given field. For example, if I only have an image for the first floorplan of a house, I do NOT have an image for the second floorplan of a house, then show the first floorplan image only.skip over that next row because the field in the db is empty. The problem that I'm having is that the syntax that I've been using to define empty in the db field does not always work. The code reads: if ($result[FLRPLAN_2] ) { printf (tr); printf (td colspan=3 bgcolor=#F0F8FF); printf (font size=5 bSecond Floor Plan:b /td/font) ; printf (/tr) ; printf (tr); printf (td colspan=3 ) ; echo img src='http://www.website.com/index_files/main_files/$planid/; . mysql_result($result, 0,'FLRPLAN_2').''; printf ( /td) ; printf (/tr ); }; if ($result[FLRPLAN_3] ) {; printf (tr); printf (td colspan=3 bgcolor=#F0F8FFfont size=5 bThird Floor Plan:b ); printf (/td/font ); printf (/tr ); printf (tr ); printf (td colspan=3 ); echo img src='http://www.website.com/index_files/main_files/$planid/; . mysql_result($result, 0,'FLRPLAN_3').''; printf (/td ); printf (/tr ); }; I have tried: 1. if ($result[FLRPLAN_3] ) {; 2. if ($result[FLRPLAN_3]) {; 3. if ($result[FLRPLAN_3]'') {; 4. if ($result[FLRPLAN_3]' ') {; 5. if ($result[FLRPLAN_3]NULL) {; and none seem to work correctly (i.e. blank field in db, but HTML row shows up with missing image..or image is in db, but no HTML row shows up. If it helps, each of the image fields are varchar(125)basically I just have the name of the image file, and then a pointer to the web server directory structure Any ideas would be greatly appreciated. Thanks. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirecting after login
using header() should work if you don't output anything before it. If you can restructure your code so that you can remove any output until after the header(), then that'd be the way to go. You said the meta refresh didn't work - did you get the syntax right? Since I don't use it much, it's one of those tags that takes me ages to get the syntax right (I could chuck it into a code repository somewhere, but I'm too lazy to do that...) Failing the above two methods, you could put a hidden form that gets auto-submitted when the page loads HTH Martin -Original Message- From: Tim Thorburn [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 2:00 PM To: [EMAIL PROTECTED] Subject: [PHP] redirecting after login Hi, A site I'm working on requires a login screen where various individuals will log into the site and add information for their various departments. Rather than setup a different script for each department, I was hoping to create one script that would either accept or deny a login based on the username/password stored in a database, then based on the username/password - redirect the individuals browser to a URL. I've got the login part working perfectly, and I can turn the URL into a link on the page, but I'd rather have the script just automatically forward the person to the page they're login gives them access to. I've tried using header(), but since the redirection takes place about mid-script, it doesn't work. I've also tried using meta tag redirects, but those don't seem to accept the PHP/MySQL combo. Any ideas? Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with Not displaying HTML if data not found
it's the mysql_result()... try this... echo img src='http://www.website.com/index_files/main_files/$planid/; . $result[FLRPLAN_2] . ''; mysql_result($result, 0,'FLRPLAN_2') ^--- you're always looking at the first row rf: http://www.php.net/manual/en/function.mysql-result.php -Original Message- From: markbm [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 2:29 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Problem with Not displaying HTML if data not found When I changed this line, it still gives me the same problem. My db field is a varchar(125)...could that have anything to do with it? Basically, the first time, without data in the field...it works fine and the TR is not displayed, but when I add data back into the field, nothing changes...its like it does not recognize that something is back in the field. I did a commit on the db each time, and cleared the browser cache, etc. Mark Martin Towell [EMAIL PROTECTED] wrote in message 6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE... what about if (strlen($result[FLRPLAN_3]) 0) -Original Message- From: markbm [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 2:02 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem with Not displaying HTML if data not found I am trying to develop a page that, in certain places, I only want it to display the TR and TDs if data is found for a given field. For example, if I only have an image for the first floorplan of a house, I do NOT have an image for the second floorplan of a house, then show the first floorplan image only.skip over that next row because the field in the db is empty. The problem that I'm having is that the syntax that I've been using to define empty in the db field does not always work. The code reads: if ($result[FLRPLAN_2] ) { printf (tr); printf (td colspan=3 bgcolor=#F0F8FF); printf (font size=5 bSecond Floor Plan:b /td/font) ; printf (/tr) ; printf (tr); printf (td colspan=3 ) ; echo img src='http://www.website.com/index_files/main_files/$planid/; . mysql_result($result, 0,'FLRPLAN_2').''; printf ( /td) ; printf (/tr ); }; if ($result[FLRPLAN_3] ) {; printf (tr); printf (td colspan=3 bgcolor=#F0F8FFfont size=5 bThird Floor Plan:b ); printf (/td/font ); printf (/tr ); printf (tr ); printf (td colspan=3 ); echo img src='http://www.website.com/index_files/main_files/$planid/; . mysql_result($result, 0,'FLRPLAN_3').''; printf (/td ); printf (/tr ); }; I have tried: 1. if ($result[FLRPLAN_3] ) {; 2. if ($result[FLRPLAN_3]) {; 3. if ($result[FLRPLAN_3]'') {; 4. if ($result[FLRPLAN_3]' ') {; 5. if ($result[FLRPLAN_3]NULL) {; and none seem to work correctly (i.e. blank field in db, but HTML row shows up with missing image..or image is in db, but no HTML row shows up. If it helps, each of the image fields are varchar(125)basically I just have the name of the image file, and then a pointer to the web server directory structure Any ideas would be greatly appreciated. Thanks. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing Special Characters In url
I think the proper way of sending an ampersand is to use amp; -Original Message- From: Ricky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 2:30 PM To: [EMAIL PROTECTED] Subject: [PHP] Passing Special Characters In url Hi, I am having problems passing variables in a url specifically when there is an sign. Any suggestions? Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Using fopen()/fread()/fscanf()
I'm thinking that you need to remove the: $contents = fread($filename, 100); line. This is probably making the file pointer point to the end of the file. -Original Message- From: Jason Soza [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 4:17 PM To: David Robley; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf() I'm fairly certain that fopen() is working fine - I can echo $contents; and it works great, but it displays the entire page that I fetched. I just want certain parts of the page and unfortunately, fscanf() doesn't seem to think $contents or $filename are valid. Just more info on this, I tried replacing fscanf($filename,...) with fscanf($contents,...) and got the same result. Thanks, Jason Soza -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 8:37 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Using fopen()/fread()/fscanf() In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I think I'm pretty close to getting this right (maybe!), I've been reading through the manual, but can't seem to work it out. I keep getting this error: [Mon Jul 22 19:03:24 2002] [error] PHP Warning: Supplied argument is not a valid File-Handle resource in index.php on line 66 I'm trying to open a URL, read the contents, then pull out specific info found between specific HTML tags. This is what I have so far: 63| ?php 64| $filename = fopen(http://www.kinyradio.com/juneaunews/latest_juneau_news.html;, r); 65| $contents = fread($filename, 100); 66| while($headlines = fscanf($filename, p style=\padding-left: 45\font face=\Verdana\ size=\3\b%[a-zA-Z0-9,. ]/b/font, $headline)) { 67| extract($headlines); 68| print a href=\http://www.kinyradio.com/juneaunews/latest_juneau_news.html\;$headli ne/abr; 69| } 70| fclose($filename); 71| ? Any ideas? Any other functions I could try instead of fscanf()? That error indicates that fopen failed to open the requested file. Given that the URL works fine in a browser, is it possible that your php is not configured to do remote fopen? Check the setting of allow_url_fopen in phpinfo() It is a good idea to test the result of such calls before trying to use the result: fopen('Whatever') or exit('Couldn't get it, Boss!'); or if(fopen('whatever') { do good things; }else{ bleat vigorously; } Cheers -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] control structure question
For steps and sequences, I always use switches. Most commonly associated with the action variable, it would look like this: switch($action) { default: // what to show if no variable exists, or is set to a value // that is not acceptable below break; case add_file: // what to do in the even that a file needs to be added // to the database. break; case remove_file: // what to do in the even that a file need sto be removed // from the database. break; } Basically, whatever the value of $action, that is what section of code will execute. Hope that helps! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Javier Montserat [EMAIL PROTECTED] 07/23/02 10:03AM is there a more programmatically elegant way of saying... $isError = ; function main() { doStep1(); if (!$isError) { doStep2(); } if (!$isError) { doStep3(); } // etc. etc. } function doStep1() { if ($something) { $isError = 1; } } function doStep2() { if ($something) { $isError = 1; } } _ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with MySQL - Can I supress MySQL errors?
Put an ampersat symbol (@) in front of the function name to suppress errors. $link = @mysql_connect(host, user, pass); Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ DonPro [EMAIL PROTECTED] 07/23/02 12:08PM Hi, I'm using PHP to connect and perform queries with a MySQL database. I've noticed that it there is an error performing certain commands like 'mysql_connect()', I'll get a warning message in the browser. I'd like to suppress these messages as I am storing the error, mysql_error(), in an array. So if there is an error, I would simply display the contents of the array in a nice format. Is this possible? Thanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP creating table for HTML layout
PHP is server-side, so it can't do anything that would help with the layout of HTML on the client-side. You might want to look into Cascading Style Sheets (CSS) to format the page so that it validates the way you want it to :o) HTH! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Briggsy [EMAIL PROTECTED] 07/23/02 04:10PM I am hoping someone can help me with a desperate problem I am having I know nothing about PHP and hoping that it might be able to solve a problem I have with HTML tables. I want my web background to cover the entire screen regardless of screen size. The background has a header, a left side nav and a footer. I want the footer to be on the bottom of the screen or bottom of the text, which ever is greater. If you go to www.v3.aru.org.nz you will get an idea of what I'm talking about. If you are using IE 5.x or greater it should show correctly. I used the HTML table tag height=100%, however this is not a valid tag and therefore Netscape ignores it. Also if I use it it wont validate as a true complaint code, which I want it to. So can I use PHP to create a table or place the background images to create a header, side nav and footer with the middle white section adjusting to screen size. I don't want to have to greater multiple sites for different resolutions and would rather have one template that all pages call by an include statement (That's the ASP command, think I saw the same command in PHP) Any help or solution would be appreciated as I have been searching the net and working on this for weeks and I'm getting nowhere. Thanks Shane. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Credit card checks?
Try this: function do_mod_10($num) { // The Luhn formula works right to left, so reverse the number. $num = strrev($num); $total = 0; for ($i = 0, $j = 1; $i strlen($num); $i++, $j=3-$j) { $digit = $num[$i] * $j; if ($digit 9) $digit -= 9; $total += $digit; } return ($total % 10 == 0); } -Original Message- From: Mark McCulligh [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 10:47 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Credit card checks? You could use an algorithms called mod10. Both Visa, MasterCard and I think most other credit cards use the mod10 algorithm. A credit card must pass a mod10 test to be a valid number(Like a Regular Expression test). It won't tell you if the number exist, but it will tell you if it could exist. I also know the mod10 is used for Canadian Social Security numbers (SIN). Unfortunately I have never seen a PHP function for it, I only used mod10 in a language called Uniface by Compuware. I know there is another name for it also, but I can't remember it right now. It is a great test, someone just typing in numbers at random will have a terrible time guessing a number right. I have never seen someone do it let. Then you can use the first character of the number to test the card type. I will see if I can locate the algorithm and email it too you. Mark Jas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Just wondering if anyone has come across the need to develop a class to test a string of numbers based on a credit card type. If you have where would I be able to get information on what string of numbers is consistent with each of the different credit cards? Any help would be appreciated! Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Banner Ad Serving...
use the auto_append or auto_prepend directives in the php.ini file -Original Message- From: Dave at Sinewaves.net [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 1:48 PM To: PHPlist Subject: [PHP] Banner Ad Serving... Is there any way of automatically adding a certain bit of code to every page on a web server (or within a given directory)? As in, is there any kind of Apache-specific PHP stuff that will add a banner ad or copyright notice to pages (without editing the actual pages themselves and without changing their file names)? I've looked around a bit, and I can't seem to brainstorm how it could be done. Any help will be greatly appreciated (with good karma to boot). :) Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. ?php header(Location: index.php); ? That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Roberts, Mark [EMAIL PROTECTED] 07/24/02 10:28AM Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
Awesome! Learn something new everyday! That's why I love this list :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Chris Sharkey [EMAIL PROTECTED] 07/24/02 11:01AM Well you can actually, If you start your script IMMEDIATELY (well before you output anything) with: ?php ob_start(); This will buffer output so you can use your header anywhere in your script eg header(location.php); exit; and then if you weren't redirected then you send the output with ob_end_flush(); Chris. - Original Message - From: Martin Clifford [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 12:47 AM Subject: Re: [PHP] Re-directing PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. ?php header(Location: index.php); ? That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Roberts, Mark [EMAIL PROTECTED] 07/24/02 10:28AM Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPMyAdmin interface
It's not normal that I've come across. Any hosting company I've ever dealt with (albeit not many, still three different ones), have all offered phpMyAdmin for interfacing with MySQL. And honestly, if the host REQUIRES you to do it, then they aren't worth hosting with. You'll find that will transcend into other areas of how they do business (i.e. technical support tickets, etc). Currently I'm hosting with http://www.websytz.com, and they have good prices. Another of my sites is on http://www.dzones.com, and they're very good as well. WebSytz' control panel flat out sucks, but it's usable. DZones has an incredible control panel, but they just didn't have the price I wanted for my current website. There's plenty out there, and since you pay monthly, you lose nothing by switching to another company. The choice is yours. BTW, I hadn't intended this to become a chapter, but it did... sorry for the length :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ [EMAIL PROTECTED] 07/24/02 12:46PM I have just recently just signed up for virtual hosting with a MySQL database. They do not have a PHPMyAdmin interface too access the database. All they have given me is my username and password and the server too login too. They suggested that I install PHPMyAdmin on my workstation and access my database that way. Is there major security risks too my database doing this? Is this normal, where service providers request that I install PHPMyAdmin on my workstation or should I be looking for a new internet service provider who supplies the interface on the server? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Backup and Restore
With phpMyAdmin, just scroll down until you see the dumping section. Select the appropriate information, tick the save as file box, then Go. It'll prompt you to save the file. You just use that file, then, as a query to your next database. Martin 1LT John W. Holmes [EMAIL PROTECTED] 07/24/02 01:38PM I've never had any luck using PHPMyAdmin for dumping databases. They always time out over the 30 second limit. I know if it was my installation, I could fix it, but these are usually with hosting companies, where that's the only access they provide. It's very much a pain in the butt... ---John Holmes... - Original Message - From: Justin French [EMAIL PROTECTED] To: Peter [EMAIL PROTECTED]; kip [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 23, 2002 11:29 PM Subject: Re: [PHP] MySQL Backup and Restore Can highly recommend doing it (and a whole lot more) with phpMyAdmin (http://phpMyAdmin.net) Justin French on 24/07/02 1:04 PM, Peter ([EMAIL PROTECTED]) wrote: grab ur self a copy of myphpadmin or use mysqldump or just simply make a copy of the data dir or grab ur self a copy of mysql_front -Original Message- From: kip [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 24 July 2002 12:58 PM To: [EMAIL PROTECTED] Subject: [PHP] MySQL Backup and Restore Hi, Can you tell me the steps of backup and restore the databases in Mysql? And can i specific a path for the backup file? Futhermore, i have installed the MySQL in Win2000 but i don't know how to restore the database of MySQL from a Linux server to Win2000 MySQL. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with msql_fetch_array()
Shouldn't it be: $result = mysql_query($sql, $link_id); PHP will be quick to tell you that there is a missing link identifier in the mysql_query() call. It's happened to me plenty of times. HTH! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ PHPCoder [EMAIL PROTECTED] 07/24/02 02:16PM Yes, what on earth was I thinking! should be: ... $result = mysql_query($sql); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); } else { echo whatever; } ... Kevin Stone wrote: You beat me too the punch and I think you explained it better than me, but just one minor little thing to note. Where you said.. if ( $result = mysql_query($sql)) This is not a valid way to check if the query has returned anything. mysql_query() returns FALSE on error. So if there was no error but there also wasn't anything returned then the object stored in $result wiill more than likely evaluate to TRUE. For the determining factor you should count the number of rows with mysql_num_rows($result). If the returned value is zero then you know it hasn't returned anything. -Kevin - Original Message - From: PHPCoder [EMAIL PROTECTED] To: Matthew Bielecki [EMAIL PROTECTED] Cc: php-general [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 11:50 AM Subject: Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is failing, the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table tablename is not there. I use the following format as my standard MySQL connect and query snippet: $link = @mysql_connect(localhost,$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the or die() bit kills the script right then and there should it not be able to connect. mysql_select_db(YOUR_DB_NAME,$link); $sql = select * from your_table_name; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo Empty result set!; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hitting return in a textarea box...
I've never had a problem with this. Even using a textbox with only the required parameters works fine as far as hitting the return key to get a newline. If you're talking about hitting the return key to submit, that's something else entirely, hehe. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Jesse Lawrence [EMAIL PROTECTED] 07/24/02 02:26PM I'm putting together a message board, and I'm having problems with hitting the return(enter) key within my textarea. I've looked around for a solution, I tried wrap=hard, wrap=soft and wrap=vitual and none of them worked (should they? I may have done it wrong?) and I also tried nohardbreaks and nosoftbreaks, but I think they may be no longer supported. Is this a case for regex? If so, can someone perhaps point me to an article on how to accomplish this? Thanks very much for any help. Jesse __ Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: create object from variable class.
This should work $object = new $classname; Martin -Original Message- From: Michiel ten Hagen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 11:17 PM To: 'Mathieu Dumoulin' Cc: [EMAIL PROTECTED] Subject: [PHP] RE: create object from variable class. Thx for quick reply, If I use the following: $object = new {classname}; I get this a parse error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in /home/sites/projects.virtuosys.nl/web/cm/includes/class_crm.inc.php on line 29 From that I conclude that with this method its not possible to create an object from a variable class name Michiel ten Hagen [EMAIL PROTECTED] 06-54673863 -Oorspronkelijk bericht- Van: Mathieu Dumoulin [mailto:[EMAIL PROTECTED]] Verzonden: Wednesday, July 24, 2002 3:11 PM Aan: [EMAIL PROTECTED] Onderwerp: Re: create object from variable class. Simple, you made an error here You are telling the new operator to look into a variable to get the classname, to specify the class name as a string do this: $object = new {$classname}; InsaneCoder Ps: I never tried this, but I think it is actually going to work, you got nthing to lose anyway I guess, takes two seconds to try. Karel De Groot [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Is it possible to create an object from a clas which name is in a variable. Example: (doesn't work) $object = new ${$classname}; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Numbers with leading zero...
you could use: printf(%02d, ++$Num); or if you want to put it back into $Num, use the sprintf() version -Original Message- From: vins [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 25, 2002 10:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Numbers with leading zero... Hi. I've got this script that needs to take for examle 02 and increase that to 03. but when i run the script $Num++; it changes 03 to 3; is there not a function that adds leading zeros onto a string ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Meetup, how many of you have signed up?
I've signed up, and I suppose I would qualify for the Washington, DC area, though that is not strictly the locale I have setup :o) As it's new, I'm sure many will be signing up in the coming weeks. Personally, I can hardly wait to sit around and chat with other PHP developers. Sign up now if you haven't all! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Jay Blanchard [EMAIL PROTECTED] 07/25/02 10:15AM Top 10 Locales -- Washington DC (9 members) Amsterdam (7 members) Leeds, UK (7 members) London, England (7 members) Atlanta (5 members) Manhattan (below 42nd St) (5 members) Melbourne (5 members) Oakland-Alameda, CA (4 members) Nashville, TN (4 members) St. Louis, MO (4 members) I am somewhat surprised that there are no more developers in Texas signed up. In my area it would just be me and one other. I was hoping to get to see enough to start a users group. There is only a total of 268 signed up world-wide. * * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/* * No developer is an island ... * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pulling records from mysql
You would need to use SQL to identify which columns and rows you need to retrieve, then use various MySQL PHP functions to gather the information. For your two queries, they would appear thus, respectively: SELECT firstname FROM tablename WHERE id=16 and SELECT firstname FROM tablename ORDER BY id ASC LIMIT 15 The functions you'll want to look into are mysql_connect(), mysql_select_db(), mysql_query() and mysql_fetch_array(). They can be found at http://www.php.net, do a search for any one of the functions ;o) HTH Martin Tyler Durdin [EMAIL PROTECTED] 07/25/02 11:18AM I have a column in my table named firstname with twenty records in it. How can i use php to pull out individual records (say for ex. record 16)? Also, how could i pull out all records upto number 15? Thanks in advance. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Paying Job...
resists the urge to debate ethics Why didn't you just say, Charge by whichever will screw the client the worst.? Jesus. Martin Tyler Longren [EMAIL PROTECTED] 07/25/02 11:44AM Charge by which ever will get you the most money. tyler On Thu, 25 Jul 2002 11:46:38 -0400 Gerard Samuel [EMAIL PROTECTED] wrote: Basically, someone is looking to get a database driven site built, and Ive never written code for money before. Im looking for advice, as to how the experienced coders in here charge for their work. Do you charge by the page, script or by the hour (that would be nice). Thanks for any input you may provide... -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pulling records from mysql
Yes, that will indeed return the rows specified, but the result is very unstable. By it's nature, MySQL does not have to conform to any sorting method unless you specify it. So it's very good practice when retrieving multiple rows to ALWAYS order them. Just my thoughts :o) Martin Tech Support [EMAIL PROTECTED] 07/25/02 12:09PM This query will return only the 16th row SELECT firstname FROM table_name LIMIT 16, 1 This query will give you all rows up to 15 SELECT firstname FROM table_name LIMIT 1, 15 Jim Grill Support Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Tyler Durdin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 10:18 AM Subject: [PHP] pulling records from mysql I have a column in my table named firstname with twenty records in it. How can i use php to pull out individual records (say for ex. record 16)? Also, how could i pull out all records upto number 15? Thanks in advance. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using one submit button
user price[] as the name you'll also need to pass the ids as $id[] so you know which one you're updating -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 11:51 AM To: [EMAIL PROTECTED] Subject: [PHP] Using one submit button Hi all, I thought I was going to give php a break today but I can't it's too adicting. I am having a little problem with a submit button in which it is suppose to update records from a form. Here is the code echo BRBRa href=\locker.php\My Locker/a | a href=\myshop.php\My Shop/a | a href=\items.php\My Items/aBRBR; echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TRTD width=20%Bfont size=2Image/font/B/TDTD width=30%Bfont size=2Name/font/B/TDTD width=20%Bfont size=2CENTERQuantity/CENTER/font/B/TDTD width=30%Bfont size=2CENTERRemove Item/CENTER/font/B/TDTD width=30%Bfont size=2CENTERPrice/CENTER/font/B/TD/TR/table; echo FORM action='$PHP_SELF' METHOD='post'; $query = SELECT uid, id, name, image, type, quantity FROM {$config[prefix]}_shop WHERE uid = {$session[uid]}; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $uid = $row['uid']; $id = $row['id']; $name = $row['name']; $image = $row['image']; $iquantity = $row['quantity']; $itype = $row['type']; echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%img src='$image'/TD; echo TD width=30%font size=2$name/font/TD; echo TD width=20%font size=2CENTER$iquantity/CENTER/font/TD; echo TD width=30%font size=2CENTERa href='$PHP_SELF?id=$idremove=yes'X/a/CENTER/font/TD; echo TD width=30%font size=2CENTERinput type=\text\ value=\\ name=\price\ size='6' MAXLENGTH='8'BR/a/CENTER/font/TD; echo /TD/TR/TABLE; echo input=\hidden\ name=\remove\ value=\yes\; } echo CENTERINPUT TYPE=\submit\ NAME=\update\ VALUE=\Updat Prices\; echo /form; if($update) { $query = UPDATE {$config[prefix]}_shop SET price = '$price' where uid = {$session[uid]}; $ret = mysql_query($query); } What I need this to do is update the price in the db table. if I have on item it is fine. If I have two items it won't update the first items price but will the second. if I try to enter a price in the first items textbox it doesn't update and then deletes the second item's price. If I have 15 items and using one submit button how do I get this to update all items that are listed? TIA Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Displaying Results
I think you can get everything after the ? in the URL with $QUERY_STRING but I think that it would be a bit dangerous to just accept what's passed, I think some checking should be done before you use $QUERY_STRING as is -Original Message- From: Jason Soza [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 10:21 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Displaying Results Sorry, I just noticed that the count() function will do at least the first part of my question, i.e. SELECT year, COUNT(*) FROM cars GROUP BY year But the second part still has me a bit stumped. I know that you can pass a variable using something like script.php?year=1991, but doesn't that assume that in your script you have something like: $query = (SELECT * FROM mytable WHERE year=$year) So the $year is the only variable that gets replaced by the script.php? year=1991 you called it with. How could I make it so that the entire 'year=$year' part of the query gets replaced by what comes after the ? in script.php?year=1991 ? Thanks in advance Jason - Original Message - From: Jason Soza [EMAIL PROTECTED] Date: Tuesday, April 16, 2002 2:49 pm Subject: [PHP] Displaying Results Suppose I want a script that goes into a table, looks up all records in a given field, and groups and displays the results like so: match1 (1) match2 (5) match3 (6) So basically it looked at the field 'matches' and found a total of 12 records, 1 record for match1, 5 records for match2, and 6 records for match3. It would also be handy for the output to be a link so when you clicked on it, it would pass a query on to the database querying for just that particular field, like: SELECT * FROM table WHERE match=match1 Can someone point me in the right direction for this? Or show me an example script that would accomplish this? Any help would be great. Thanks a lot! Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nasty DoS in PHP
[snip] If this allows a DoS attack, then this is a very real security problem. Why should it? Even if there is a verifiable bug allowing time/memory limits to be exceeded when header() goes into an infinite loop, how could someone exploit this from the outside? If a scripter is letting any random web visitor put their script into an infinite loop, then the results are at *least* as much the scripter's fault as PHP's. [snip] As far as I can tell, the only security problem here is the usual one: figuring out who is clueful enough and responsible enough to be trusted with access to operations which can compromise the server. A coder could do a lot more damage to a server, than a DoS, if they had access the PHP. Oh! The fun I would have if I was malicious (but I'm not BTW). There's more at stake than a simple DoS if someone can upload a PHP script to a server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nasty DoS in PHP
Is that memory usage used by PHP or apache? -Original Message- From: Jason Soza [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:35 PM To: CC Zona Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Nasty DoS in PHP For what it's worth, I just ran this script on my server, and despite the 30 second time limit and 8mb memory limit in php.ini, the script ran longer than 30 secs, CPU usage went between 60% and 100% and my memory usage reached 352000 before I stopped it. As far as a DoS, I don't think so. A bug? Possibly. Bad coding? Yep. :) Jason Soza - Original Message - From: CC Zona [EMAIL PROTECTED] Date: Wednesday, April 17, 2002 6:21 pm Subject: Re: [PHP] Nasty DoS in PHP In article p05100304b8e3cee5ab0c@[210.49.237.250], [EMAIL PROTECTED] (Richard Archer) wrote: At 8:55 PM -0400 17/4/02, Justin Farnsworth wrote: This is a rather meaningless thread. It is a security issue that is displaced. If PHP is not honoring the time limit and memory usage directives when outputting headers, then this is a bug in PHP. A big if, since the OP has not yet verified that the time limit and memory limit are in effect at the outset of the loop as supposed. Someone else want to test for this scenario? Someone, that is, who can deliberately bring down their server without getting kicked off permanently? Meanwhile... If this allows a DoS attack, then this is a very real security problem. Why should it? Even if there is a verifiable bug allowing time/memory limits to be exceeded when header() goes into an infinite loop, how could someone exploit this from the outside? If a scripter is letting any random web visitor put their script into an infinite loop, then the results are at *least* as much the scripter's fault as PHP's. Ditto for the scripter who sets the infinite loop himself while allowing the web user to specify what function gets executed in the loop. And if neither of these is happening, then where's the DoS? As has already been pointed out, someone bringing down their own server with their own code, isn't a DoS. It's usually poor coding, and _possibly_ (see above) attributable to a bug, but it's not a DoS. As far as I can tell, the only security problem here is the usual one: figuring out who is clueful enough and responsible enough to be trusted with access to operations which can compromise the server. Whether there is a bug or not remains an open question. I'll be curious to hear whether anyone is able to reproduce a server crash in spite of set_time_limit(30) and ini_set(memory_limit,8M) conditions. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] need your help
is this a local server you're connecting to (as in, on the same machine as the script) if it is, then the ip address would prob. need to be 127.0.0.1 and not 172.0.0.1 -Original Message- From: Waty [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 1:29 PM To: [EMAIL PROTECTED] Subject: [PHP] need your help Hi, i got error when open the imap: my code : $mail_server = 172.0.0.1; $mail_port = 143; $utg_box =1; $mail_id = username; $mail_pass = password; $open_mail_box = {.$mail_server.:.$mail_port.}INBOX..$utf_box; $mbox = imap_open($open_mail_box, $mail_id, $mail_pass); error: Couldn't open stream {172.0.0.1:143}INBOX.1 Please help thanks a lot Regards Waty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and Quicktime...
you don't need php to do this - use html's embed to do it -Original Message- From: Pusta [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 3:49 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP and Quicktime... Hello all, I'm new at PHP but learning and loving it. For a school project, I have to use PHP to display a video on a web page using QuickTime. Can anyone point me to where I can get some info on how to do this? Thanks, Chris -- 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] Open Download-Box
Hello! I have a PDF-File, which the user should download (it should not open in the browser, even if the Adobe-Reader-Pluging is installed). I use: $filename = $DOCUMENT_ROOT./.$QUERY_STRING; $fd = fopen ($filename, rb); $contents = fread ($fd, filesize ($filename)); fclose ($fd); header(Content-type: application/octet-stream); header(Content-Disposition:attachment;filename=$savename); echo $contents; This doesn't work in IE (Version 6, 5 is not tested yet): When I get the download-box and I choose open instead of save, the download-box opens again! Then pressing open, everything is okay, but why is the box opened twice? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open Download-Box
try header(Content-type: application/pdf); Thanx, but it doesn't work, too, on IE. Another effect is, that Netscape now opens it in the broser window instead of downloding it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to popup a new browser window from php
use vbscript :P otherwise no - php = server - [java|vb]script = client -Original Message- From: Wo Chang [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 9:15 AM To: [EMAIL PROTECTED] Subject: [PHP] how to popup a new browser window from php Dear All, One simple question: Is there any easy way to popup a new browser from PHP without using any Javascript? Any helps would be greatly appreciated. --Wo -- 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] printer functionality under 4.2
hi anybody knows how to activate printer functionallity under 4.2 ?? why was it removed from the releases afer 4.1 ?? thx m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP @ 24-hour programming competition
Firstly, since you can take in already written code, if you have a lot of pre-written generic code, that would be good. We're really interested in your opinions - is this feasible or are we just plain mad? :) You've probably both - aren't all programmer mad? g -Original Message- From: Dennis Moore [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 21, 2002 2:45 AM To: Visontay Peter; [EMAIL PROTECTED] Subject: Re: [PHP] PHP @ 24-hour programming competition This sounds interesting... I am not familiar enought with PHP-GTK to give an informed opinion. I think your decision should be based on how familiar with the tools you take into the contest.Since you are not face with a lot of time, will your competition be using Visual IDEs to aid the rapid development? You may wnat to post to one of the php-gtk-* lists. They may be able to address your needs in more detail. Good luck!! If you choose to use PHP, please post the results of the contest to the list. It should be interesting. - Original Message - From: Visontay Peter [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 7:43 PM Subject: [PHP] PHP @ 24-hour programming competition Hi! I have quite an unusual problem for you :) There will be a 24-hour programming competition at our university, where teams of 3 have one day to solve a complex problem (which will be revealed on the day of the competition). Teams cannot get help from outside, so no outward network / phone communication is available, but you can use anything you take there with you (any development tools, books, pre-written software etc.) The language in which you write the software is up to you, the most popular choices being C++ and Java - but this year our team are going to use PHP (and PHP-GTK). The big question is: will PHP be enough for the whole project, or will we need something else (like external C/Java modules)? Last year the task was to write an artificially intelligent soccer game based on a client-server architecture: there was a server acting like some kind of game controller (referee) and 2D display screen, while the automated clients (players) were playing individually according to the game's rules and some simulated information on what they 'see' at the time. It's said that it will be something quite different this year - but required knowledge includes: algorithm theory, information and code theory, artificial intelligence, queuing, databases, client-server architectures, computer networks, control theory, 2D graphic programming and software ergonomy. All this in 24 hours - nice, eh? :) So the question again - are there any parts of all this where you think PHP will not be enough? (Apart from the graphics, for which we'll use PHP-GTK). If so, what kind of outside module integration do you recommend for us? Also, which PHP sites / resources / code libraries do you think we should (recursively) download which might help us a lot? (Apart from php.net, of course.) We're really interested in your opinions - is this feasible or are we just plain mad? :) Thanks, Peter Visontay http://prodigycenter.com/cv/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Better standards in PHP-coding
(Just got back from the weekend) Just my 2c worth IMHO, as long as the code is indented properly, it doesn't matter where the braces are, just be consistant. Personally, I prefer to put the opening brace on a new line, but I can just as easily read other people's code when the opening brace is on the same line (as long as it's indented properly). As for indenting - I prefer using spaces and this ensures that my code will look the same in someone else's editor as it does in mine. There are people here, in the company, that use tabs and have set their tabs to be 4 spaces, I have my tabs set to 8 spaces - really plays havoc when they indent quite a distant :( Also, with one line statements, I prefer to place it on the same line as the statement that requires it (ie, function, if/else, while, do, etc). But, again, as long as the coder is constant, I find it just as readable when the statement is on a new line, surrounded by braces or not. So what I'm basically saying is - choose a style that suits you, and be _consistant_ with it - oh, and make sure you indent your code, there's nothing worse than trying to read code that's not indented, or indented all over the place! Martin -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 21, 2002 9:10 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Better standards in PHP-coding Hi I like the following form, not sure how much time gets wasted in parsing but it's easy for me to follow :) while(something): if(something else): yada; else: forget it; endif; endwhile; Tom At 11:51 AM 21/04/2002, Frank wrote: The nice thing about standards is that there are so many to choose between. Subject: Uses of block markers in coding snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Open Download-Box
this is a problem of IE, not of PHP. Year, but since I controll IE with PHP, I thought someone has a php-workaround. Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] From where was function called?
um - (unix) grep (windows) find files That's something that I've been wanting for a while - a function call stack that the php script can look at. -Original Message- From: Nico van der Dussen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 3:04 AM To: [EMAIL PROTECTED] Subject: [PHP] From where was function called? Hi, I'm having a real problem: In a codeset of more than 5000 lines of code, I have a rogue call to a function. Is there a way I can determine in a function from where the call was made? (Filename, linenumber etc) Thanks Nico -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: AW: [PHP] Re: Second opinion needed - javascript blocker
What about: 1. getting rid of anything between script and /script.* 2. get rid of any attributes that start with on and end with a quotes or space Maybe I'm forgetting about some valid attributes that start with on, you might have to cater for them Does this work? HTH Martin -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 6:49 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: AW: [PHP] Re: Second opinion needed - javascript blocker Thynks, but I don't want to block html, I want to block javascript! And since onmouseover and similar events can be put in any tag, I'm trying to block them. on 4/22/02 4:44 PM, J Smith at [EMAIL PROTECTED] wrote: Then I'd suggest using the strip_tags() function and define which tags you'd like to leave untouched. J Red Wingate wrote: He might want to use this function but doing so no links or bold underline Tags will be destroyed as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unsubscribe?
[snip from bottom of msgs] PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php [end snip] -Original Message- From: Josiah Wallingford [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 10:38 AM To: [EMAIL PROTECTED] Subject: [PHP] Unsubscribe? How do you unsubscribe to this mailing list? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why isn't this working? :(
Can someone try to figure out what's wrong with my code? What are you expecting, and what are you seeing? -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 11:12 AM To: [EMAIL PROTECTED] Subject: [PHP] Why isn't this working? :( I have a site where users can sign up. I have had huge problems with people using auto-signups, so I tried to stop them with an authentication image. Someone has since gotten around that. I highly doubt he is using OCR. Can someone try to figure out what's wrong with my code? Here it is: Contents of auth_image.php: ?php $dbh = mysql_connect (MYSERVER, MYUSER, MYPASS); mysql_select_db (MYDB,$dbh); $authimage = ImageCreate(40,15); $white = ImageColorAllocate($authimage, 255, 255, 255); $black = ImageColorAllocate($authimage, 0, 0, 0); header(Content-type: image/jpeg); $getcode = mysql_fetch_array(mysql_query(select * from signupcodes where id = '$id')); imagestring($authimage,5,0,0,$getcode[code],$black); imagejpeg($authimage); imagedestroy($authimage); ? Some code from signup.php: //I do seed the random number in the header $code = mt_rand(1000,); mysql_query(insert into signupcodes(code) values('$code')); $codeid = mysql_insert_id(); input type=hidden name=codeid value=$codeidimg src='authimage.php?id=$codeid'br bCode from above:/b input type=text name=codebr At top of proccess_signup.php: $getcode = mysql_fetch_array(mysql_query(select * from signupcodes where id = '$codeid')); if($code != $getcode[code]){ die(bError:/b wrong code); } In the middle of process_signup.php, after I've done checks of a few other things: echo You're a member! :Dbra href='/'Back to homepage/a; mysql_query(delete from signupcodes where id='$codeid') or print -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Interesting Links, can be not PHP
it's a bookmark basically, it's telling the browser to scroll the page down until it finds the named bookmark eg a name=topTop of page/a blah... ... a href=#topgo to top/a clicking on that link will scrol the page to top in your case, it's a no-name bookmark, and most browsers treat this as either don't move or top it's useful when doing onClicks, etc. when you don't want to user to go to a different page HTH -Original Message- From: Mantas Kriauciunas [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 5:17 PM To: PHP General List Subject: [PHP] Interesting Links, can be not PHP Hey PHP General List, Well i have seen some strange links last few months earlyer i didn't look at them because i didn't care... and now i am curious... how to understand link like this Http://www.foo.com/# and thats it... links ends and as it sayes for example it links to Our Works page on that website... how to understand that # ? can anybody expain? or give link to explanation ? :--: Have A Nice Day! Mantas Kriauciunas A.k.A mNTKz Contacts: [EMAIL PROTECTED] Http://mntkz-hata.visiems.lt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ASP to PHP
I used it for a site I did. The code wasn't doing anything too funky. Just simple accesses to adodb and also simple form manipulation - worked like a treat. Although, the database stuff, it converts it the standard PHP functions, but I had some classes for that, so I still had to manually go through and change the code -Original Message- From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 9:38 PM To: [EMAIL PROTECTED] Subject: [PHP] ASP to PHP I got a strange request from a client. He wants to be able to take his ASP pages and move them over to PHP so that he can run them on apache on his linux server. I saw a tool yesterday ASP2PHP, but I am wanting to know does it work, how much is lost, is it easy to use? Is there another way to change ASP file to PHP with out a lot of re-writes? Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Wich Database abstration layer?
I hope we're not going to get into the this db class is better than that one thread again -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 9:28 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Wich Database abstration layer? Hello, Javier wrote: Can anybody recomend me a nice DB abstraction layer that is not included in phplib? You may want to try looking at Metabase. It assures true database portability. http://www.phpclasses.org/metabase Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to give vars to a php(shell env) script?
try setting an environment variable before calling your script -Original Message- From: Hermann Bier [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 12:34 PM To: [EMAIL PROTECTED] Subject: [PHP] how to give vars to a php(shell env) script? Hi NG! how could i give some vars to a php script, that is directly executed by php-parser. for instance: #!/usr/bin/php -q ? echo $SOME_VAR; ? is it possible at all? thanx for advance. Hermann Bier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Warning
or make it $config[prefix] -Original Message- From: Jason Murray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 1:51 PM To: 'Jennifer Downey'; [EMAIL PROTECTED] Subject: RE: [PHP] SQL Warning Would you please direct your attention to this URL http://testphp.netfirms.com/code1.html Look at the bottom where the big orange commented syntax is and explain what is going on there? {$config[prefix]} I think this should be ${config[prefix]} ... also, it's handy to actually echo or print the SQL you're executing, as you will be able to see if the SQL is correct or not. The error on line 14 occurs because you're trying to execute mysql_fetch_array on a mysql result set that doesn't exist. The most likely reason it doesn't exist is because the SQL is wrong. Echo the SQL and you'll find out whats happening. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Warning
The reason why I said that is 'cause the array was inside quotes, so quoting again would break out of the original quotes -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 2:03 PM To: Jason Murray Cc: [EMAIL PROTECTED] Subject: RE: [PHP] SQL Warning On Wed, 24 Apr 2002, Jason Murray wrote: {$config[prefix]} I think this should be ${config[prefix]} Those are equivalent. miguel -- 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