Re: [PHP] PHP textbook suggestions?
I'd still like some actual recommendations for a good book for beginners. My PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide has already been mentioned by someone and gets good reviews. If you want something more basic, I wrote PHP for the World Wide Web: Visual QuickStart Guide for the non-programmer. It goes at a much slower pace but obviously doesn't cover as much. Although neither is technically a textbook, both are used as textbooks in high school and college classes. For a recommendation without the self-interest, the Thomson and Welling PHP and MySQL something something something (Sams) is a very good book (I forget the title, but it is good and thorough). Whatever you look at, make sure you get the latest editions. I know that Amazon doesn't necessarily offer up the latest edition of a book, so you sometimes need to click on All Editions to see if it's been updated. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] __construct __destruct in PHP 4
I have been trying going thru the PHP manual to find if there are any equivalent to the __contruct and __destruct in PHP 4, but I cannot find any solution for this part. I know it was introduced in PHP 5, but as __sleep and __wakeup exist in PHP 4 already I was hoping there is something like __init and __die in PHP 4 :-) In PHP 4 the constructor has the same name as the class (like C++). See http://us3.php.net/manual/en/language.oop.constructor.php There is no destructor in PHP 4. Larry PS The manual has two sets of OOP documentation: one for PHP 4 another for PHP 5. Make sure you're viewing the right set. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [JOB] PHP Book Tech Reviewer
I'm currently writing the second edition of my PHP Advanced book and need a technical reviewer. It is a paid job and some people think it's interesting/looks good on a resume/etc. Obviously you'll need to be an expert in PHP and pay close attention to detail. My definition of advanced for this book means: - OOP - Doing what you already do but better and faster - Tangential topics (GD, PDFlib, CLI, PEAR, XML, Ajax, MySQL, E- Commerce, other buzzwords). Experience in these areas required. You must be able to work quickly (the entire book must be reviewed over the course of a month, I think). If you are interested or have any questions, please email me off-list. Thanks, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/mysql/phpMyAdmin on an iBook?
I'm thinking of getting an iBook for reasons not really to do with webbing but really need to do occasional php/mysql stuff to justify the expense. I believe that they all come with an Apache testing server installed and wondered if anyone had any success with getting php/mysql/phpMyAdmin working on one of these machines. No problem at all. Mac OS X comes with PHP installed (but not activated). There are precompiled binaries of both PHP and MySQL available from www.entropy.ch and mysql.com, respectively. phpMyAdmin runs on anything that can run PHP and MySQL. No problem at all! Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clear POST variables
How do I clear out the POST variables, or the variables that I have set from the POST variables, so that when the page is refreshed it will not resubmit. I have tried unset() and have tried to set it to and empty value, but it doesn't seem to work. You can clear out POST by doing this: $_POST = array(); But that won't do anything in your case because every time the page is refreshed the form is resubmitted (and POST is repopulated). You need to find a way to ensure unique entries in the database. One option is to store a hidden, random value in the form, like a timestamp or the md5() of a random value. Then store this in the db, along with the other data. Put a unique index on that column so that the same random value cannot be inserted multiple times. (In other words, the form would need to be reloaded, then resubmitted for the data to go into the db.) HTH, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LIMIT?
I have a news page which is getting quite long now and I would like to split the news to two pages. Now I have one SQL query for all the rows and I think I could use LIMIT to limit the results but how to limit the results for example to 15 rows for page one and from 16 to the last on second page? Number of rows increase daily. One page one there's headline and short summary and the second page should be archive with only the headline so all remaining rows can be printed to one page. Something like: SELECT * FROM `x_news` LIMIT 0 , 15 but how to do the archive page SELECT * FROM `x_news` LIMIT 16 , xx? What you're describing is called pagination. There are examples online. Basically you just need to pass to the second (and other) pages the LIMIT values (16 and xx above). Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] input validation?
I need to check that user input text is less than 300 characters long. How? if (strlen($_POST['input']) 300) { ... You may want to also apply trim() to the input text to get rid of extraneous white space at the beginning and end of the input. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forum
Does anyone of you know of a good forum that is easy to customize and supports sticky notes, user registration, bb code and stuff like that? I would suggest that Phorum (www.phorum.org) and phpBB (www.phpbb.com) are the two biggies (written in PHP). Both have all these features plus many available mods. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gotta learn asp.net...
On Wed, November 9, 2005 6:54 pm, Joseph Szobody wrote: *sigh* I'm a hardcore PHP programmer.. I've been using it for over five years now, and would consider myself fairly advanced. I have a project where I'm being forced to do some ASP.NET development, which I've never touched. I need to learn it fast. Nobody has enough money to make me do ASP again. ASP.NET is leaps and bounds better than ASP. I would never use ASP but do do the occasional ASP.NET job (although PHP is my primary and preferred language). I'm not sure about learning ASP.NET fast, but you should start by: - Picking a language to use. VB Script and C# are the biggies. IMHO VB Script is easier, C# is better. - Picking an IDE. WebMatrix is free and easy to use. Visual Studio .NET is expensive and not easy to use but potent. - Knowing what database you'll be using. Probably Access (which totally sucks) or SQL Server (which kind of sucks). Other than that, I personally always start with a good book. If you do that, pick a book that uses the same language and IDE that you'll be using. Also, in my opinion, having a good knowledge of how to create a dynamic Web site helps when going from PHP to ASP.NET. If you know what the program must do in terms of functionality, protocol, etc., then it's mostly a matter of picking up the right syntax. I found that ASP.NET is the opposite of PHP: doing something simple is ridiculously hard but doing something kind of complex is pretty simple. All the built in widgets and wizards help and the form validation tools are really nice. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fixing ID's in mySQL Table
Is there a way to fix ID sequence in a MySQL table using PHP? Basically I have some tables with a lot of records, 1000 to 5000. ‘ID’ is the Primary Key column in these tables, and at the time the code was originally written, there weren’t much verification of data being input going on. Thus a lot of junk records were being let in, which had to be deleted at some point or another. Now the ID sequence is all screwed up. It’s not in sequence anymore. You may not like this answer but you shouldn't fix this. Primary keys, by definition, should never change. Their purpose is to uniquely refer to a record. If you change the primary key of a record, then you've undermined this purpose. If you have holes in your sequencing, this isn't a problem either, as how the records are stored in the database is completely meaningless. If you need the records to be listed in some sort of order, you should add another column or table that manages that. But leave the primary key alone. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No forums?
One of the fallacies in your argument is that the lack of an official forum on php.net implies such distaste for message boards. I don't have a big screen TV but I have anything but distaste for them! Well, let me give you a different example. I don't have a TV at all, even though I could buy one. Knowing this, would you assume that I don't like watching it? No, I wouldn't, as my point is that the lack of something doesn't imply _any_one_thing_. There are many reasons why something may or may not exist. Assuming that there is such distaste for message boards is fallacious (as would be my assuming you don't like TV). The same thing with forum. It's a usual feature, just like website is. Would you be surprised if PHP had no website? Yes, I would, particularly as I've been going to it for years. Finding out that PHP had no website would definitely mess with my perception of reality. But I disagree with your theory that having a forum is implied by the technology. PHP is open source, so the fact that ANYBODY freely supports it in any way is just plain nice. Also, you should realize that your question could be rephrased as Why hasn't someone else done all this extra work (creating and managing a forum) because I would prefer it? Are you saying that I'm the only PHP user that might like discussing things on a forum? I'm pretty sure I didn't say that but I'll have to check my notes. I'm saying that you seem to be incredulous over the lack of something which you think makes sense. But my point is that there can be any number of reasons why php.net does not have a forum so the lack need not be ironic. In fact, that lack may even make sense (at least to those that run the Web site). Besides, you're implying that maintaining forum is extra work, while maintaining mailing lists isn't. Extra work for extra users you can live without, eh? Eh? What? Well, it IS extra work. The mailing list exists and, many believe, work just fine. Doing more than what is currently being done is extra, right? Or more? I'm almost positive about that. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mac folder
I have shared my windows folder 'wwwroot' across the network but when I preview my .php file it connot find it because the specified php folder on the mac is http://127.0.0.1/~myname/Sites Actually the folder is ~myname/Sites but the URL should just be http://127.0.0.1/~myname You should not use Sites in the URL, as the Mac is already setup to redirect ~myname to the user's Sites directory. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register Globals
mail($to, stripslashes($_POST[subject]), wordwrap($_POST [message], 60), From: $_POST[from]\r\n); and I get: Parse error: parse error, unexpected '\', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www-html/emailer/index.html on line 41 The use of $var['index'] or $var[index] ($_POST['from'], $_GET [to], etc.) within double quotation marks is causing the problem. To fix this, wrap the whole construct in curly braces: mail($to, stripslashes($_POST[subject]), wordwrap($_POST [message], 60), From: {$_POST[from]}\r\n); You only have to do this within other quotation marks and only if the array's index is a string. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No forums?
AFAIK, there are no official forums for PHP. Considering the fact that PHP is a web development tool, such distaste for message boards is ironic at the least. So why exactly there aren't any forums on php.net? One of the fallacies in your argument is that the lack of an official forum on php.net implies such distaste for message boards. I don't have a big screen TV but I have anything but distaste for them! Also, you should realize that your question could be rephrased as Why hasn't someone else done all this extra work (creating and managing a forum) because I would prefer it? The obvious answer, which someone else has already suggested, is that maybe others (or those in charge of php.net) don't feel the need. In any case, if you are sincerely interested in either a support Web forum or a legitimate answer to your question, you may have better luck if your inquiry were more I would appreciate it if... or has an official forum been considered? and less this system that you've been using for years sucks and this is why I'm right. All that being said, I think everyone should send me $5. I've monitored this list long enough to predict the most probable replies... Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connect to MySql
I have windows XP sevice pack 1 and 2, PHPv5.0.5, Mysql v1. I am working in web design. I am unable to connect to the mysql server. Althought my php files running fine and my mysql server is also running fine. i) i had changed the php.ini-dist file to php.ini. ii)i uncommented the extensions of php_mysql.dll in php.ini file iii)i set the extensions_dir to extension_dir = D:\PHP\php-5.0.3 \ext\ in php.ini file iv)i had copied the libmysql.dll in windows\system32 and windows \system but after all these i am still getting the error Fatal error: Call to undefined function mysql_connect() in D:\PHP\teknohub\new.php on line 14 please help me to solve this problem out. You haven't successfully enabled MySQL support. You can confirm this by running a phpinfo() script. Did you restart Apache after editing the php.ini file? And are you certain you are editing the _right_ php.ini file (the one indicated when you run phpinfo())? Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcookie() is not my friend
I'm trying to setcookie('username',$username,15552000) but on subsequent pages $_COOKIE('username') is always null. I verified that I'm setting it before any other output is sent to the browser. I verified that $username does have some valid contents. I also verified that the browsers I'm testing are set to allow all cookies. I do have a $username and a $_SESSION ['username'] that contain the same data. Well, the stupid/obvious question is: are you checking $_COOKIE ('username') like you posted or $_COOKIE['username'], which is syntactically correct? Secondarily, have you set your browser to prompt you when a cookie is sent and, if so, what happens? Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]PHP Syntax Notation
I'm trying to expand my understanding of PHP by looking at some pre- built code modules. I don't fully understand the syntax $site-Run (); in the following code. Can someone offer a helpful explanation? ?php //define(PB_CRYPT_LINKS , 1); define(_LIBPATH,./lib/); require_once _LIBPATH . site.php; $site = new CSite(./site.xml,true); $site-Run(); ? The $site variable is an object, specifically an instance of the CSite class. Run() is a method (i.e., a function) defined within this class, so the statement $site-Run() executes that function. This is basic object oriented stuff which you may not have run across before. Hope that helps, larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] colleges/schools that offer php/web development courses
can you guys give the names of any schools/colleges that have formal programs to teach web development/security applications. I was teaching one online through the University of California at Berkeley. I'm no longer teaching it but my understanding is that they'll be hiring a replacement and the class will be available again. It is a credit-earning course. The URL is http:// explore.berkeley.edu/UCExt/courseview.asp? secid=426value=relatedaction=Internet Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [JOB] Need a Developer for PHP-MySQL Project
The National Coalition for Dialogue and Deliberation (NCDD) is seeking an independent contractor or company to perform some PHP and MySQL Web development work. In simplest terms, the Web site is a MySQL-driven content management system (CMS), written in PHP, running on a Unix/Linux server. The project can be done remotely but must be completed by the end of 2005. A full and descriptive request for proposal can be found at http://www.thataway.org/misc/ncdd_rfp.pdf Questions can be addressed to the contact person named in the RFP or by replying to this email (not to the mailing list). Thanks, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload
I might have asked this already but I am still ignorent ;-) How to check if a same name file already exists in a upload directory when uploading new file? Use the appropriately named file_exists() function. L. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Arrays between pages
Please can someone tell me how you pass arrays between PHP pages. $var = serialize($testArray); echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$var\; Then unserialize the variable on the receiving page. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-text searches sucks?
which means because I i getting a match for well over 50% of the records...its disregarding it. Yes, this is exactly the problem. Now i am in two minds if i should use this or go back to the same old dirty way...of exploding the search and using LIKE '%%' for each word FULLTEXT searches are great; it's your testing of them that is poor. What validity is there is searching through X number of identical records? This isn't a real test at all. Also, FULLTEXT searches are improved as the number of __different__ records increase. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-text searches sucks?
Thanks for replying. You're quite welcome. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. I dont want to do that as its only mysql 4.1+ compatable, IN BOOLEAN MODE was added in version 4.0.1 not 4.1, for what it's worth. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WORK WITH PHP FILES REMOTELY WITH NotePad ? YES/NO ?
WORK WITH PHP FILES REMOTELY WITH NotePad ? YES/NO ? I want to know if when be online I CAN OPEN A FILE FROM A WEB LOCATION HOST - MINE and after I modify it save it again to my hosting space WITHOUT save it to my PC first using NotePad and I mean entering the host usernamepassword when OPEN / SAVE ...? ATTENTION: I DO NOT MEAN SAVE IT TO MY HDD FIRST AND AFTER UPLOAD IT !!! TELL ME THIS SAMELY FOR Dreamweaver MX ? First of all, you need to calm down, STOP YELLING, and be less aggressive in your emails. Remember that you're asking for free help from strangers here. Second, what you are asking is a Notepad question, it actually has __nothing__ to do with PHP. Third, Notepad is a very bare bones text editor and does not have features like the one you're looking for. Fourth, a great way to see what an application can do is open it and look at the menus. Like File. Like FileOpen. Fifth, yes, Notepad can open remote files if you can connect to the remote server from your computer. This is true of any application. Sixth, can __you__ actually connect to your remote server from Windows so that you can open a networked file? Um, I'm guessing not. Seventh, many FTP applications let you set an external text editor. This would let you connect to the server, edit a file in Notepad, and save it, without saving it to your hard drive first. Eighth, many of these answers will be the same for Dreamweaver, although that's a much more sophisticated application. That being said, DW probably has the ability to open and edit remote files. You know what would be a good way to find out for certain? Check out a DW reference or open the application. Ninth, there's is no number nine. Tenth, again, this isn't really a PHP question. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT Re: [PHP] can I compile php source
While Yes may be a technically accurate answer to a question like Can I ... or Can anyone ..., a couple of points must be acknowledged: 1) Such an answer doesn't help the original poster. Period. And the purpose of a resource like this is to help, right? Even a RTFM or search Google at least gives the user __something__ to work with (and the lesson there being that if they read the manual or search Google, they'll quickly find answers). If your argument for answering Yes is that you're teaching the user to ask questions the smart way, then why not answer their intended question AND refer them to the smart questions page? Do you honestly think people are learning __anything__ when you reply with a Yes? Moreover... 2) It's commonplace in human discourse to attempt to address the *intent* of a person's question rather than the literal question itself. If you were helping a friend re-shingle a roof and they said Can you hand me that hammer?, hopefully you would actually hand them the hammer, not say Yes. They are many colloquialisms in languages--like when someone says What's up?--and it's just obstinate not to recognize them as such and respond accordingly. Finally, if you don't agree that Yes isn't helpful and that it's an inappropriate answer anyway, how about this: such emails are a waste of resources. It's a waste of the time (.1 nanoseconds or whatever) it took you to write. It's a waste of bandwidth (at a few bits a pop). It's a waste of everyone's time in reading and deleting such emails (another second). And it tends to start a sequence of even longer, off topic threads such as this one. So, seriously, if you don't feel like helping or you don't believe that a message should be posted here because it's off topic or you don't believe that a question was phrased properly, wouldn't it be better for everyone if you just didn't respond? It'd certainly be easier. Oy vay! Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can I compile php source
Guys, this is trivial. It takes the same effort to provide the answer to whoever this guy was, than to lecture him on how to think. Teach a person to fish ... That's a good and true adage and certainly a philosophy to be put forth by this list. But, the question is, does an answer of Yes teach a person anything? I truly suspect not. Whereas Yes, here's how, and by the way you should read this page about how to ask smart questions. teaches a person quite a bit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] first letter
if i have for example this variable $name = John; how can i echo the first letter only so the result on the browser will be J echo $name[0]; You could also use the substr() function. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ScreenHeight?
Is there any way of getting the clients screenheight in PHP? (or do I have to do it in Javascript) You have to do it with JavaScript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql insert into 2 tables
Hi there - I was wondering if anyone could point me in the right direction to be able to add data to two different tables (I am using mysql and php V4). I understand joins, etc for the query of the data, however adding the data - still getting my head wrapped around it (multiple tables). You'll need to run separate INSERT queries, I suspect. If one query relies upon a primary key created by the other, make use of the mysql_insert_id() function. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: and statement
err i mean ... an 'or' statement sry is there an 'and' statement for mysql, when you are doing multiple wheres? MySQL allows SQL statements that support both AND and OR. With OR, you can often use IN instead. SELECT columns FROM tablename WHERE (condition1) AND (condition2)... All of this is in the MySQL manual, of course. Larry PS Technically speaking, this question would have been more appropriate on a MySQL list (or the PHP-DB list). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] alert function
In html, there is the alert() function that makes a popup with a ok button. Is there such a thing in php? Actually, that's a JavaScript function. You can't do the same thing in PHP although you can use PHP to create the JavaScript. Printing an error message, like you already had, is probably a better choice, though (IMHO). Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object oriented??
Is PHP an object oriented language. If not is it gonna be? PHP is not an object oriented language (like Java). Although PHP supports the creation of objects, you can still do pretty much everything without ever using OOP. I can't imagine PHP ever being turned into a true OO language, but I could be wrong on that. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object oriented??
Yes of course...but was confused since some says it is so and some says it is not...So thought of asking the pros.. It is. PHP4 had limited support for OOP, though it was quite usable. PHP5 goes further and provides pretty much everything else. See the documentation on php.net for the complete language reference. I guess this is where the OP's confusion stemmed from (Robert said Yes, I said No)! A liberal definition of OO is An adjective applied to any system or language that supports the use of objects, under which PHP would qualify. But, in strict OO languages, everything must be done using objects. You can't even do a simple Hello, World without them (I could be wrong on this, of course). With that understanding PHP would not be OO. So, in short, PHP __supports__ objects but does not __require__ them. There's a good chance that 20 people will chime in now, with their own corrections. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting screen resolution
is there a function that gets the screen resolution of the user? you can also reply directly to me... [EMAIL PROTECTED] No, you cannot get the screen resolution using PHP. You must use JavaScript. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User Screen Resolution
I am new to PHP and couldn't find any Globals for the User's Screen Resolution. (don't laugh at me please) I used to use a Javascript function to pass the resolution using screen.width and screen.height. What I am actually trying to do is make a page resize depending on screen resolution, in case that helps anyone. Using PHP you can neither find the screen resolution nor resize the browser window. Both must be accomplished using JavaScript. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac OS X and Editor
Hi guys, I just like to ask those using Macs here as to what editor and/or IDE they are using for writing PHP codes. BBEdit is generally consider to be one of the best (note: I said one of the best, not best, so let's not start about how emacs, vi, and vim are better) text editors available on any platform. It's very easy to use yet powerful (supports grep, works with Xcode, has command line tools, etc). The new version 8 ties into Apache, letting you test PHP scripts in the application. It's a text editor, not an IDE, though. There are PHP- and SQL-specific libraries built in so that it recognizes function names and such. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] empty variable
What is the best way to determine if a variable is empty? I have a feeling there is a better way than the way I'm doing it now... if ($variable == ) You could try the empty() or isset() functions, depending upon exactly what you're wanting to test. See the manual for descriptions of both. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xml tags interfere with php tags
How do I get an xml tag to work with a php script? ?xml version=1.0? php is trying to parse that. Either turn off the Short Tags setting in your php.ini file or have PHP echo out that line. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does this beginner's book exist?
Does a book for complete beginners exist that also demonstrates basic good programming practices, has decent examples, and perhaps exercises/quizzes (not as important as the first two)? The newest edition of my PHP for the World Wide Web: Visual QuickStart Guide takes into account register globals and addresses new additions in PHP 5 (as well as those things in PHP 4.3.x). It still doesn't have quizzes or exercises, though. Best wishes, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extra byte added to PDF streaming file
I've seen cases where extra buffer content gets added to the downloaded file. The problem was fixed by deleting any existing buffer before sending the file to the client. Not sure that will solve the problem but it's worth a shot. How does one delete an existing buffer? ob_end_flush();? ob_end_clean() For future reference, you should normally reply to the entire PHP list, not just to the person replying to your message. That way you're not imposing upon a person trying to help and you're not waiting for that one person to respond. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extra byte added to PDF streaming file
It appears as though some readers (such as adobe acrobat) can read this file fine yet others (such as the program gv in *NIX) cannot read it. The reason for this is that somehow a hex 0A is added before the inital %PDF-1.2 which marks the start of the PDF file causing some readers to not recognize it as a PDF file. Is there anything in this code which could possibly (always) cause an extra byte (0A) to be added before the real start of the file? And no, the file is not corrupted (I've already tried that) - this only happens when it goes through this script, and not loaded directly as example.com/file.pdf. I've seen cases where extra buffer content gets added to the downloaded file. The problem was fixed by deleting any existing buffer before sending the file to the client. Not sure that will solve the problem but it's worth a shot. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] viewing PHP files on Internet Explorer 6
Rocky, First off, when working with mailing lists like these, you generally should reply to the entire group, not to an individual person. Doing so takes the burden off of the person who initially replied to you. Moreover it means that you won't have to wait for that one person to get back to you. Thanks Larry, but how do i save my php files to http://localhost? I don't understand if this is a subdirectory in apache or not. You don't mention your OS but I assume it's Windows. I forget the details and it depends upon your installation of Apache but you'll want to save your files in a location like C:\Apache\www. You can always check the Apache documentation for assistance on things like this but it should be a 'www' folder. Because when i do access the php scrips via URL (e.g. http://localhost/test.php) i get an error message saying the page does not exist. It is currenly saved in a regular folder away from apache. Yeah, you need to place the files in the Web root directory. Larry PS I've cc'd the list on this message, to widen the knowledge loop. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is Function Constants the Correct Term?
I have been experimenting with defining functions as constants. Below is what I am using to test Function Constants: pre ? define(LOGIN,user); define(PASS,pass); define(DB,mysql); define(DBLOGIN,dblogin(LOGIN,PASS,DB)); This is simply not allowed. see: http://php.net/define Can you elaborate on what is not allowed? Are you saying defining function constants are not allowed or are you saying redefining constants are not allowed? I believe the answer is that both concepts are not allowed. Constants, by their very definition, cannot be redefined (except for magic constants, which is a different thing). Also, constants must be set as scalar values. PHP doesn't support function-like macros as you might have seen in the C preprocessor. This is all in the PHP manual, under define() and constants. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] viewing PHP files on Internet Explorer 6
So I have Internet Explorer 6.0 with XP and have also installed Microsoft .NET framework 1.1. I can't get my .php files to be viewed with my web browser. html files are diplayed okay but with php files i get a blank screen. I guess i need plug-ins for Internet Explorer but i thought that .NET covered that. Btw, I'm using Apache 2 and MySQL 3.23 with PHP 5.0. Can anyone give me a helping hand? Thanks A couple of suggestions: - Make sure you're accessing the PHP scripts via a URL (http://localhost/mypage.php) - Turn on display_errors in your php.ini file and then restart Apache. It's possible you have an error which is causing the blank screen. - If all else fails, run a simple phpinfo() script: ?php phpinfo(); ? to test your PHP installation. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP on MAC
We've just bought a new Power Mac G5 Macintosh computer for the office and I'll need to do some backend engineering work using it. I've never worked with PHP on MAC, so I really have no experience with what happens on a MAC... are there on issues regarding working with PHP on a MAC? Not at all. OS X is essentially Unix and you've already got Apache built in. I believe it comes with PHP installed (but not enabled) but I would recommend using Marc's installer from www.entropy.ch. This will give you the most current version of PHP (normally). In short, PHP is great on a Mac. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] displaying database results with forward and back buttons
I have a query that returns lots of rows so I want to display the results in blocks of 25 or so on my web page and have forward and back buttons to navigate the results. Can someone point me in the right directions please I have tried to look around for something using google but cant think of a suitable search term I think pagination might be the term you're looking for. I'm pretty sure there's a PEAR class which will help with this or you can check PHPBuilder.com or Zend.com for articles on the subject. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get the month's last day
how can i retrieve the last day of the month? like 31 - Jul, 30 - Jun , 28 - Feb ?php $month = 8; $year = 2003; $lastdayofmonth = mktime(12,0,0,$month+1,0,$year); ? You could also use the date() function with the t parameter. Of course, that also requires a timestamp... Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to retrieve value from database and echo on screen
/* Select User's First Name From Table */ $sql = SELECT UserFirstName FROM RegisteredMembers WHERE UserID='$_POST[TXT_UserID]'; $result5 = mysql_query($sql) or die (couldn't select UserID from database); $num = mysql_num_rows($result); /* Welcome Registsred Member */ echo welcome to the registered members area ; echo ($result); There are a few problems here: 1) Your query result is assigned to $result5 but then you use $result in the mysql_num_rows() function. 2) You never fetch any information. You need something like $row = mysql_fetch_array($result5). 3) You're trying to print the query result when you should be printing the fetched information like so echo $row['UserFirstName']; Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help ???
I wonder why my website runs smooth in PHP 4.1.1 but it does not in 4.3.7. Without knowing any relevant details at all, I would suggest that the settings are different between the two servers, particularly register_globals and magic_quotes. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Reporting
I ave a strange problem with my error reporting! I have set php.ini to: error_reporting = E_ALL but I don't see any errors. (After I was happy things were working on my Apache Test Server, I uploaded to my web host and discovered errors.) Make sure that display_errors is on and that you restart the Web server after changing the php.ini file (as another responder already pointed out). Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] post data
im posting a form to itself... and im wondering if there is any way to clear the post data from the page after if have dealt with it? $_POST = array(); Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start() warnings
When I use session_start function, I receive the following warning messages: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/w4t3c101/public_html/ListClientInfo.php:2) in /home/w4t3c101/public_html/SessionControl.php on line 9 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/w4t3c101/public_html/ListClientInfo.php:2) in /home/w4t3c101/public_html/SessionControl.php on line 9 Can anyone explain why it happens and how to solve the warnings. Thanks :) Something on or about line 2 of ListClientInfo.php is sending data to the Web browser. This could be HTML, plain text, or blank spaces. Get rid of that and you'll get rid of the warnings. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] export from mysql to csv file
Can anyone point me to an existing script or tutorial to learn this? I'm fairly sure there's a tutorial at PHPBuilder.com or Zend.com. Or you can check the PEAR modules for code (I know there are database to Excel classes). If all else fails, Google's always helpful. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] previous page
Thanks all makes sense, but, if I add this: ?php echo($_SERVER['HTTP_REFERRER']); ? I don't get anything back when the page is called? Yes, that can happen, which is why I said it wasn't perfect. I think using some sort of form to go through is the better option. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] previous page
I have a .php page I don't want anyone being able to just open it unless they've been through a previous page that is a disclaimer http referrer etc come to mind but not exactly sure how to implement it in PHP. Yes, you could check the value of $_SERVER['HTTP_REFERRER'] but that's not perfect. Instead, you could have the previous page contain a form with a special hidden input. The form is submitted to the protected page, where you check for that hidden input's value. If that protected page doesn't receive $_POST data containing whatever meaningful data, redirect them accordingly. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about good coding practice [isset]
if($var) do something; verses if(isset($var)) do something; The simple form if($var) seems to work fine and I see it in code often. Is there a good reason for using isset? Yes, if you don't use isset(), you may see notices (errors) if the variable is not set. This depends upon the error reporting settings of the server. However, if you use isset() you won't see notices regardless. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding Screen Size
I know it's easy to find the screen res of a user from javascript- but I want to let my PHP script know what the resolution is. Is this possible? I would like the easiest way possible- I'd rather not resort to sessions/cookies. Is there a way to make a variable available to PHP? I find the get_browser function really useful for the browser info but it doesn't tell me the res. This comes up occasionally here so you can check the archives for different solutions. But the basic answer is that you CANNOT use PHP to find the screen size. You must use JavaScript and then pass these values to PHP using cookies, forms, etc. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies
Does Any One Knows How To Set And Get Cookies? The PHP manual is really good for stuff like this. Check out the setcookie() function. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables
When using a link like xxx.proceed.php?language=gbr the 'proceed.php' script does not receive any $language variable. Does someone know how to get it run? This is a register_globals issue. Refer to $_GET['language'] instead of just language. Or, at the top of your script, add $language = $_GET['language']; and you shouldn't have to change anything else. See the manual for $_GET and $_POST for more information. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Letters and Numbers limitation
Form takes parameter username, so I want to accept username taht includes only numbers and letters. How can I check if variable contains only letters and numbers? Use regular expressions. See the PHP manual (for PCRE or POSIX) for more. You'll also find a number of tutorials online about validating form input with regex, I suspect. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP (and optionally MySQL) textbook
I am looking for suggestions for a textbook for an undergraduate class introducing PHP and MySQL (using PHP, not MySQL administration). Right now I am using the McCarty book PHP 4 A Beginner's Guide but there might be new and/or better books out there? Both my PHP for the World Wide Web: Visual QuickStart Guide and my PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide are being used for similar classes at Northwestern, Penn State, and in high schools. People say they're pretty good, particularly for beginners. For the online PHP class I teach through Berkeley, I use one of Julie Meloni's PHP books (couldn't use my own, in case you were wondering). Her books are great for beginners, although there's a lot of overlap between the two so pick just one. Finally, the Welling/Thomson PHP and MySQL for Web Development (or something similar to that) is excellent. A bit more expensive and more advanced in focus, but very thorough and well written. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] onChange
I have 2 list fields in a form. The second is populated basing on selection in field 1. Can anyone pls tell me how to do this in PHP ? You can't do this with PHP. PHP is server side which means it only reacts after a request has been made to the server (by loading a Web page or submitting a form, for example). For what you're trying to do, you'll need to use JavaScript, which is client side. You can use PHP to help create the JavaScript, though. There are some ready-made scripts available for this purpose (search Google). Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP SESSION DURATION.....
Correction: I meant to say: Are session variables stored server-side or client-side like cookies? The session data is stored on the server. The session cookie (if there is one) is stored in the browser. How do I go about making a session last longer that the duration of the browser? Set the expiration on the session cookie so that it's a month from now, using the set_session_cookie_params() function. Also, force the users to accept cookies (somehow). Then change the garbage collection so that it won't trash session data for at least a month. Considering how inefficient all of that is, you might be better off storing the data in a database instead of a session and then storing the database record ID in a cookie in the browser. There are some serious security considerations here but it will get your results and won't rely upon PHP's sessions. Again, this isn't ideal but it's a start... Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] recursive acronym - PHP
Why PHP is a recursive acronym?, I know that before was called Personal Home Page, I now is Hypertext PreProcessor, but why is recursive?, I person told me that it could be wroten as Pre Hypertxt Processor, thanks. PHP stands for PHP: Hypertext Preprocessor. It's called a recursive acronym because it uses itself in its definition. Another example: GNU, for GNU's Not Unix. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Anyone that can inform me of good books to buy or free tutorials on the net that can guide me through building a good dynamic website. People seem to think my books are pretty good (http://www.amazon.com/exec/obidos/ASIN/0321186486/dmcinsiinc-20/002 -8800445-6161652). PHP and MySQL Web Development is also a great book. For tutorials, there are plenty out there. Check out Zend.com, PHPBuilder.com, and, of course, the manuals at PHP.net and MySQL.com, which will get you started with installation and such. Both PHP and MySQL are free, so you can get going right now at no expense. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo issue RESOLVED!
However, I don't see the point in discussing this topic any longer. You won't change your opinion and Apple afficionados won't change their opinion either. I would like to suggest that you try Linux, BSD or OS X before you speak. On the bright side, Linux, Windows, and Mac OS X all run PHP. And this IS a PHP mailing list. So might I be so bold as to suggest the end of the Mac vs Windows vs Linux thread? (Since this is, um, a *PHP* mailing list.) Larry PS This thread also stopped being about ECHO a long, long time ago. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multiple entries for a variable passed with GET
I've got a form with a text entry list allowing the visitor to select more than one entry. The multiple entries are passed in the URL properly (see below) but the QUERY is only using the last one listed. What's up? URL being passed... http://www.cancerreallysucks.org/RobesonWeb/robeson1searchB.php? manufacturer=JUKImanufacturer=REECEmanufacturer=WELDTRONSubmit=Submi t The problem is that $manufacture (or $_GET['manufacture']) is a scalar variable, meaning it can only have a single value. The last value assigned to it (WELDTRON) will override the others. Turn manufacture into an array (by making the HTML form input name manufacture[]) and you'll be good to go. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Menu populated based on previous menu
Searched all the sites I could find for this problem to no avail. I have two dropdown menus in a form. The first menu contains a list of MANUFACTURERS obtained from a database. The second contains a list of MODELS also obtained from the database. I want the second menu to be populated based upon the selection in the first. In other words, once a visitor has selected a MANUFACTURER they'll be presented with a list of MODELS that are available from the selected MANUFACTURER. I know how to do the queries, but don't know how to initiate the query and rebuild the second menu when the first selection is made without adding a SUBMIT button and loading a second page. You can't do this with PHP (server-side), you'll need to use JavaScript (client-side). Check out some JavaScript sites for examples, then use PHP to populate the JavaScript arrays. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Idea for new operator
Is it just me, or would everybody else like to see a case-insensitive string comparison operator introduced into PHP? It is a type of comparison that I use a lot, and having to strtolower() everything before comparison can impact code readability, not to mention the angst, pain and trauma of having to repeatedly type 'strtolower()'. I was feeling generous so I went back in time and added this functionality to PHP as of version 3. I call it the strcasecmp function. I placed the description and usage of the function in the PHP manual: http://www.php.net/strcasecmp Hope you like it! Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] search by keyword
on the search_results page, what happens is: -i use explode() to break the comma-delimited string down into array elements, and count() to count the number of array elements -then i use a for loop to cycle through the list of array elements and run a sql query to search through a table for any matches to a particular array element. the for loop looks like //for loop that cycles through elements in an array, and searching through a mys ql table for matches for($j=0; $j$count_elements; $j++) {$sql.=and columnname like '%keywords[$j]%' or columnname2 like '%keywords[$j]' or columnname3 like '%keywords[$j]%'...';} i think this is technically working, since it's not giving me any errors, however it basically slows down searches to the point of unusability. If you are using MySQL, look into FULL TEXT searches. MySQL 4 also has a binary mode which is pretty good. Make sure you've indexed your columns as well. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
which is more efficient to do: 1. option value=1?php if($th_order==1){echo SELECTED; } ?Something1/option option value=2?php if($th_order==2){echo SELECTED; } ?Something2/option (or) 2. instead of having the ?php and ? mixed in the HTML is it better to echo/print the whole lines? Really just a matter of personal preference. If I have a mostly PHP page, I would use echo to print out chunks of HTML. If I have a mostly HTML page (or section of a page), I would use separate ?php ? sections within it. I doubt you'd notice any performance difference between the two so use whichever is easier for you to code. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php|cruise - do unto others...
To make a donation, simply login to PayPal and click the Send Money tab at the top of your screen. Once there, put [EMAIL PROTECTED] in the Recipient's Email field and fill out the remaining fields to your liking. :) Even though this thread is much more PHP-related than many of the topics discussed here (sadly), could it be taken off list, please? Cpt Holmes is certainly a valuable asset to these lists but the time everyone spends reading two emails (PHP General and PHP-DB) every time someone does or does not donate to the cause is time better spent earning money for the cause, no? Not trying to be cranky, just worried that the 16 emails I've already seen in the past hour may not be the end of it! Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP within Frames
Does anyone know why my PHP pages won't work in Frames? I have 5 frames, each of which are displaying PHP pages.and none of the PHP code works. PHP works just fine within frames because the two issues are completely unrelated. That being said, I can't tell why you're having problems as you've: - Posted no code - Posted no links to the working (or not working) example - Not explained what you mean by none of the PHP code works One good reason why none of your code would work would be if your frame document was referencing your PHP files as filename.html as opposed to filename.php. But, considering the information provided, that's just a guess. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating a Search field
I need to create a feature that allows users to enter certain words that can be searched ie search = 'red lion' this would return all data found with the words red and lion. If you're using MySQL 4.0, you can take advantage of its FULL TEXT searching (it's actually available in earlier versions but much better in MySQL 4). See the MySQL manual for more information. Otherwise, you'll need to parse the search box data to break it up into individual words, then create a query like... WHERE column LIKE '%$var1%' AND column LIKE '%var2%%'... This will be slow, so make sure your database uses indexes. Again, see the MySQL manual for more. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generate Receipt Number
I am doing a receipt system whereby it can auto generate a unique receipt number for each receipt. It will be an increment of number eg.01, 02, 03, and so on.Wonder how should I go about doing this using PHP? Do need some help here..technologies used are:PHP and MySQL... Since you're using MySQL, create a table for your receipts with a receipt_number which is an auto_incremented, primary key, unsigned, not null, integer. When you add records to this, set this column's value to NULL or 0 and it will automatically use the next sequential number. See the MySQL manual for more. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Subcategories in php
I have been trying to do this for weeks but i just cant figure this out. I have categories that have subcategories and i want to insert them into database. My table looks like this: cat_id, parent_id and cat_name. Let's say i wanna insert a subcategory that is associated with its parent category. If I understand your situatoin, I would create two tables: categories (category_id, category_name) subcategories (subcategory_id, category_id, subcategory_name) Then, in your PHP script, have the user select the category and enter the subcategory name. The SQL INSERT would then be INSERT INTO subcategories (category_id, subcategory_name) VALUES ($cat_id, '$subcat_name'); Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_GET_VARS VS. _GET
I notice the use of _GET in some messages. Is this the same as HTTP_GET_VARS[]? More or less. $_GET was added in version 4.1 and has an added advantage of being global in scope (it's a superglobal). Where in the manual is this documented? http://www.php.net/release_4_1_0.php http://www.php.net/manual/en/language.variables.predefined.php Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array encapsulate
if ($_POST[detail][11][116] !$_POST[detailtext][19][114]) { How can I encapsulate the array so it is a multi-dimensional array and not just a string length? I'm not exactly sure what you're array structure is but that syntax is correct. $_POST['key1']['key2']... Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function returning array
Nothing. But it I run: function getData() { etc.. print_r ($theArray); return $theArray; } the data is definitely there. I think the example in the PHP manual goes something like... function getData () { // blah, blah return array ('value1', 'value2', ...); } Then you would call it with list ($var1, $var2, ...) = getData(); Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function calling from url
I would like to call a function from a FORM's ACTION attribute. This is what I'm trying to do: FORM ACTION=www.example.com/PHP_FILENAME/function_name? parameter1=xparameter2=y etc... Well, you're not going to call a function that way, but you will submit the form to the PHP page (PHP_FILENAME) and that page can call the function. If the action attribute was script.php?p1=xp2=y Then script.php would have function_name ($_GET['x'], $_GET['y']); You'll probably want to do some validity checking on the GET data, just in case. Hope that helps, Larry PS Just to be clear: you can't call a PHP function using a form since a form is on the client and PHP is on the server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] webserver for mac
what do mac owners use for a webserver? OS X users (Server and Client) use Apache 1.x, which is built-in. People with earlier versions of the operating system (OS 9 and earlier) used WebStar (I don't know if it supports PHP) or WebTen by Tenon (which is just a version of Apache and does support PHP). There may be others but those are the big two, I believe. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error problem
Sorry the second echo Hello world; was meant to have no semi colon Just so you know, PHP allows the last command in a section to not have a semi-colon. Therefore the code ? echo Hello world ? would not cause an error message. If you're trying to purposefully cause an error, you'll need to change your trigger. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Display variable with spaces
And I try to display it in the table using this : input name=email_1 type=text id=email_1 size=50 value = ? echo $email_1; ? if I try to echo the variable $email_1, I get the correct value i.e. thisisa long e-mail address /// However when it comes to displaying it using the table all I get is the thisisa . It simply avoids the spaces. Can anyone tell me why this is happening..?? I am sure it is something pretty minor but I just cant seem to get it right. You need to quote your value attribute. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_real_escape_string
The following function is from Larry Ullman's PHP and mySQL on page 217 - script 6.8 - in which there is a connection to a mySQL database using PHP. My question is that I'm not sure of the global variable $dbc. Hello Anthony, The mysql_real_escape_string() requires a connection to the database. The connection identifier is defined in another script so it's brought in using the global statement. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rounding issue
$x = 4.5012412; echo round($x, 2); // results in 4.5 --- however I want 4.50! I want 2 decimal places! echo number_format ( round ($x, 2), 2); Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installation for OS X
Does anyone know of a good installation kit like FoxServ, phpTriad, etc for Mac OS X? I want a quick solution for adding MySQL, GD, phpLib support for my mac. Follow Marc's instructions at http://www.entropy.ch/software/macosx/php/ He provides a compiled version of PHP that includes MySQL support, GD, and much, much more. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini
Does the php.ini file always go in the same place no matter the OS? I did a locate in the shell, and nothing came up. I could find .ini files, or php. files, but no php.ini files. In all likelihood, you don't have a php.ini file on your computer, which is why searching for it using conventional methods won't help. To create a php.ini file, you could download the PHP source code, take its php.ini and drop it in /usr/local/lib Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RedHat
Where would I go on the redHat site to ask when they are going to upgrade to PHP 4.3 and MySQL 4.x (now in production). Our CS dept. won't install them for me until RedHat bundles it. I'm using RH 7.3. This question would probably be best directed towards: 1) The RedHat site 2) A RedHat newsgroup 3) A RedHat mailing list 4) A RedHat forum 5) A RedHat __, not the PHP general mailing list (since your question concerns RedHat packages). I expect that a RedHat support would be much more qualified to answer this question and your original one (when they'll upgrade). Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Theft
i just want to figure out a way by which i can stop session theft.i thought if i can get something from user end that is unique for that user.for e.g. his/her IP .but it will not work when they are behind firewall.they will be assigned same IP.is there a way for me to get the IP (e.g.202.202.202.202 thats just an e.g. ) plus computer ip(192.168.0.1 e.g.) i saw once a java chat server do this.if we can do this then it will help us (SOMEWHAT). You could store the HTTP_USER_AGENT in the session when it starts. Then compare the browser being used against this stored value on subsequent pages. HTTP_USER_AGENT won't always be unique and it's not foolproof but it is a little extra security with minimal effort. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading large files through php
The problem that I am facing is that I can get the script/browser/php to pass such large file. I have modified the upload_max_size variable in php.ini to be larger the 60Mb but this still does not help! Is there any hard limitation that I am unaware of? You'll probably need to adjust the following: max_execution_time = 30 ; Maximum execution time of each script, in seconds max_input_time = 60 ; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) ; Maximum size of POST data that PHP will accept. post_max_size = 8M Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ob_start problem
Warning: ob_gzhandler() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in /blahblah/includes/bottom.inc on line 25 I can't speak as to why this would only happen occasionally, but I believe that you should comment out the output_buffering line in the php.ini file when using the ob_gzhandler function. Or so says a user-contributed note in the PHP manual... Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload files and file types
hi there , i was wondering on security of file uploads , i am currently using the pear uploader class , i can check for allowed file extensions , but it doesnt seem to check for file type , i can currently rename say an image to zip and it uploads , is there anyway a hacker could rename an executable to a zip and able to upload it and execute it ? I can't address your specific question but here are a couple of recommendations: -Rename the uploaded file so that the user won't know what it's called on the server. -Store the file outside of the Web directory so it's not accessible via HTTP. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Separators in variable values causing MySQL commands to fail
OK, I can bypass my oversight by stripping out apostophes from the variable values. There has to be a better way please. Turn on Magic Quotes GPC or use the addslashes() function. Or, if you want to be more precise and MySQL-specific, use the mysql_escape_string() or mysql_real_escape_string() functions. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running DB on different server
Can the DB be on a different server than the page server? Yes. For example, with MySQL, you just need to create a user with permission to connect from a remote computer by setting the appropriate host value. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Devel Environments???
The only product I know of that fits your description (I think) is JaneBuilder (http://www.seejanecode.com). It's currently available for Mac and will be on Windows soon. Never used it myself... Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() question
Is there an easy way to display the epoch time given by time() in a human readable format? Basically, if I do $time = time(); and the insert that data into my mysql database and then pull that information out again how do I make it look like 2003-03-13 or a variant of that? If you are pulling a date/time out of a MySQL database, use MySQL's DATE_FORMAT() function to format the value. For that matter, you can use MySQL's NOW() function (or others) when inserting the time. Otherwise, just in PHP, you can use the DATE() function to format dates. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser Sniffing
I know, it can't be done in PHP. That's not exactly what I'm here for. I have a client who would like to redirect people to a polite 'upgrade your browser' page whenever people visit his site (which has been developed in PHP no less). My question here is, how can I make this so that regardless of what URL someone comes in to, it will always run the sniffer prior to loading the actual URL they visited? In other words, whether the visitor comes to the main url (http://www.site.org), or whether they are going to a specific link (http://ww.site.org/seethis/), the client would like the sniffer to check them all. I know I can stick the whole javascript sniffer into each and every file, but that's just not efficient. Being that this site was created in PHP, I can very easily stick an 'include' in each file to include the javascript piece, however how can I use the results of that javascript piece inside PHP to then do a Header(Location...) type thing? Can I even do that considering that javascript normally goes within the head.../head section, at which point the page headers were already sent, and doing a Location redirection within PHP will only result in an error. This can be done using PHP, the HTTP_USER_AGENT variable, the get_browser() function, and a browscap.ini file. Check out: http://www.php.net/manual/en/function.get-browser.php Make a script that determines the browser being used which redirects if necessary. Include this at the top of every page and voila! Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL
This is OT, I'm considering buying the MySQL, Second Edition Paul DuBois book. I'm using MySQL 3.23. Should I be buying the first edition DuBois book instead or does BuBois cover both 3 and 4 in the second edition? Is there a huge difference between 3 and 4? Here's a URL for the second edition: http://www.kitebird.com/mysql-book/ It discusses what's new in this edition. Paul DuBois is also very active on the MySQL mailing lists so your question would probably get a more detailed answer there. Also, in all likelihood, the first edition may not even be available anymore. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL
What are some of the more active MySQL lists? Do you have a URL or two? http://www.mysql.com/documentation/lists.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Yarrrrgggghhhhh || Simplest php question in existence........
Any performance issues re: using fetch_row vs. fetch_array? No significant performance issues. If you want to be precise and save a little overhead, use $row = mysql_fetch_array ($result, MYSQL_ASSOC); The returned record will ONLY be returned as an associative array. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php