Re: [PHP] Suggestions on FAQ application?
Why re-invent what is already written? I'm well aware that it's easy to write but there may be something out there already that suits my needs and has some features that I hadn't thought of. If you don't have a suggestion on a package please spare me the rude replies which seem to run rampant on here lately... Though I agree the reply given was rather crude, and I think also unnecessary, so was you question. It is rather a waste of the time of the list's membership to spend their time doing searches for you to find code packages. It is my impression, at least, that this list exists to provide assistance on a somewhat higher level of issues. Your question was worded in such a way that it wasn't very different from this: Hi every one, I want to create thumbnail of a photo stored in MySQL table online. Best Wishes, S. Naqashzade And that is not something I care to bother with. I spent the effort of typing php thumbnail mysql photo into Google. And as a surprise to some, I had to refine the search once to get that, and what you're looking for you'll sometimes have to scroll down for or *gasp* even head to the next 10 results. I suggest going to Google's directory: http://directory.google.com/Top/Computers/Programming/Languages/PHP/Scripts/ try doing a search for FAQ. Since I really don't know what it is you want, I can't help much more than that. The basic idea is spend some time searching, look inside of well-known script sites, dig through the search enginges... You might also be able to strip the FAQ section out of PHP Nuke, but that's a confusing mess in its own right. Forgive my bitterness, but Sometimes you end up looking at a question and going Why am I wasting my time on this? This person expects me to do everything but make their site. Don't straight-up ask for info on questions that are covered EVERY WEEK, and do look at more than just one site. -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] count characters without space
who knowes how to count the charcaters in a string without the space character? Using a regular expression to strip out all the spaces before passing to the word counting function seems easiest. You'll be left to adapt it to PHP, but the regexp is: 's/ //g' That removes all spaces. If it gives an error, try s/\ //g to escape the space. Pass the result to whatever you use to count the number of characters. -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL vs PostgreSQL
I'm just deciding which DB to use for my projects and I'm not clear with one thing... When considering a database for web, is MySQL good enough? I read it only supports table locking, which is not very satisfying in such a multiuser environment as the internet.. PostgreSQL has transactions and locks single records - MySQL locks whole tables. I read something like this: MySQL is more popular because a lot application is made in MySQL. If you make a new application from the base - choose PostgreSQL. See MySQL 4.x. They also have subselects now (HUGE!). As for an understanding of the importance of row locking vs. table locking, it's probably only going to be an issue if you're recieving a large number of hits per second that actually need to lock records. Be sure to read up on the different table types that are available and their features. It would help if we had a better idea of the goal of your application (EG slashdot doesn't need to lock its user records, etc.). Or it wouldn't matter much if you used 4.x. Based on your experience, what are pros and cons of MySQL and why most of you prefer to use MySQL to PostgreSQL, which is aparently more powerful.. Honestly? MySQL seems to be more actively used, and more actively developed, and has more programs with hooks for it (even though SQL should be truly universal *sigh*). And I just like it. Didn't really need anything PostgreSQL had to offer at the time, and when it comes that I do need things like subselects, I'll just upgrade my version. -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL vs PostgreSQL
Not to cause a flame war, but, MySQL and PostgreSQL are both excellent choices, MySQL tends to be a lighter less feature rich database while PostgreSQL tends to have more features, perform better under load, etc. Under differing types of load, yes. MySQL is more hit-based, while PostgreSQL deals well with bigger queries. So basically undisputed. You can read a lot about the two databases at google.com and also at postgresql.org. I highly dispute the claim that MySQL is more actively used or that it is more actively developed, PostgreSQL has a very good sized user base with a lot of both non commericial community support and commericial quality support. PostgreSQL does have its own significant user base. I think MySQL has a larger user base. Of course, I won't state that user base is a heavily weighted factor in this case (or in most). There are a large number of applications that use postgres as well, even if there weren't the reasoning there are lots of applications that use this product so it must be good is amazing to me, if that were true Windows would be the winner because there is the most commercial support for windows, there is also the most applications for windows so therefore windows must be better than Unix (we all know that is not true, at least in most cases). This is not intended to cause a flame, just to balance the comments, as always you should do your own benchmarking or at least do in dept research before deciding on any solution. Your mileage will vary so take other people's advice carefully, in the end look at performance, stability, ability to scale, and support. My understanding is for speed / fast + simple queries go with MySQL. Heavier or more complex / long queries go with PostgreSQL. I'm biased to MySQL (though unhappy with lack of subselects, but have found that I can sometimes write better queries when forced to avoid them), so take with a large dose of salt. As for the comment about subselects in version 4 being available, well... I am right that they are... but they're sorta not out yet as was stated so... well, let's just say my words taste bitter on the way back down *sigh* -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function passed as argument to function
For reference, see http://autocracy.homelinux.org/template.php and http://autocracy.homelinux.org/error.php Unless you have a good reason to do otherwise please post your code here. People would be less inclined to help if they have to go about clicking on links to see what your problem is. Noted 1) Do you really mean list_writings(poetry), or did you in fact mean list_writings($poetry)? list_writings(poetry); or more accurately std_layout(Recent Writings, list_writings(poetry)); I've also tried that using various methods of quoting for the list_writings(poetry) and also doing strange things like making anonymous functions and defining the function as a variable and what-not. 2) How did you conclude that? Did you check that list_writings(poetry)/list_writings($poetry) gives the correct result? IE echo list_writings(poetry)/list_writings($poetry) ? list_writings(poetry) simply spits out the output. 'echo list_writings(poetry)' was not designed as the proper way to use the command. Here is the current code for the function (in its half-complete but working state with mysql_connect() and mysql_select_db replaced with generic variables for public consumption), and also the std_layout function following: function list_writings($table) { $db_link = mysql_connect($host, $user, $pw) or die(DB connect failure); mysql_select_db ($db_name) ; $query = SELECT wid, title, description FROM $table ORDER BY wid DESC LIMIT 15; $result = mysql_query($query, $db_link); while ($row = mysql_fetch_row ($result)) { print a href=\/poetry.php?wid=$row[0]\$row[1]/abr; }; }; function std_layout($ltitle, $ltext) { echo table width=\100%\ align=\top\ tr td valign=\top\ table style=\border-top: 1px solid #00; border-right: 1px solid #00\ width=\175\ tr td bgcolor=#B0C4DE valign=\top\ nbsp; $ltitle /td /tr tr td $ltext /td /tr /table /td td valign=\top\ ; } ; Basically, I want std_layout to be able to take either straight text as an argument or the output of a function (even if it's through a mid-point such as a variable). That failing I'm going to have to admit a design flaw to myself and re-work the code... -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Guestbook
The quick solution, if you intend to continue the autoincrement field, is to number the entries manually when you're displaying them: Something along the lines of: $count = 0; while ($row(mysql_fetch_array($result_id))) { $count++; echo Entry $count; ... ... } The right solution (and not much slower) is to use a different table type for your DB. Read up on what different tables types in your DB support. Note that this won't make any difference if the one you're deleting isn't the last one in the series... there basically isn't a work-around for that which doesn't eat proc time. -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Function passed as argument to function
std_layout(Title here, list_writings(poetry)) both std_layout and list_writings are user-defined functions. std_layout() echo's the two arguments that it takes at select points in its execution. I want to the output of list_writings() to be an argument for std_layout(). -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function passed as argument to function
On Saturday 30 November 2002 03:14 pm, you wrote: On Sunday 01 December 2002 03:54, Jeffrey B.Ferland wrote: std_layout(Title here, list_writings(poetry)) both std_layout and list_writings are user-defined functions. std_layout() echo's the two arguments that it takes at select points in its execution. I want to the output of list_writings() to be an argument for std_layout(). Hmm, what's the problem then? Functions take any valid expressions as arguments. If list_writings() returns a valid expression then you should have no problems at all. For reference, see http://autocracy.homelinux.org/template.php and http://autocracy.homelinux.org/error.php template.php is the proper layout, and uses the same code as error.php, with the exception that LEFT SIDE TEXT has been replaced with 'list_writings(poetry)'. Note that the output from that function occurs where it was placed within the code, not where it was called to... Basically, instead of the output from list_writings(poetry) being passed to the function, it simply executes. -Jeff SIG: HUP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php