php-general Digest 19 Aug 2007 11:43:44 -0000 Issue 4970
php-general Digest 19 Aug 2007 11:43:44 - Issue 4970 Topics (messages 261005 through 261013): getting from one table listing from another 261005 by: Nate 261006 by: Stephen Johnson 261007 by: Jay Blanchard Delete row in a lookup table 261008 by: nitrox . 261010 by: Larry Garfield Re: Cookies and sent headers 261009 by: Kelvin Park 261011 by: Otto Wyss Redirection with header (was Re: [PHP] Cookies and sent headers) 261012 by: Otto Wyss Re: www.soongy.com 261013 by: Gevorg Harutyunyan Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- I know this is kinda crazy but I need it :P I have one table that lists name's and I have another table that has the name's and points I want to know how to list the name's of the first table by the points of the second table ---End Message--- ---BeginMessage--- You might try sending this to a group that is more orientated towards data basing.. Since that seems to be what your asking about... On 8/18/07 3:53 PM, Nate [EMAIL PROTECTED] wrote: I know this is kinda crazy but I need it :P I have one table that lists name's and I have another table that has the name's and points I want to know how to list the name's of the first table by the points of the second table -- Stephen Johnson The Lone Coder http://www.myonlinepros.com *How can we help you today?* [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- ---End Message--- ---BeginMessage--- [snip] I know this is kinda crazy but I need it :P I have one table that lists name's and I have another table that has the name's and points I want to know how to list the name's of the first table by the points of the second table [/snip] Not crazy, pretty standard from a database point of view; SELECT a.name, b.points FROM table a LEFT OUTER JOIN table b ON(a.name = b.name) This only works if the name in table a matches a name in table b. ---End Message--- ---BeginMessage--- Hi all, Is it not considered good practice to have a primary key on a lookup table for a database? I have 3 tables setup, games, memberleagues and members. The memberleagues table holds the id of the games table and members table. The problem I have is that Im not sure how to delete a row from the memberleagues table without a primary key. If its not considered bad practice I could add a primary key to the memberleagues table and be done. Anybody have any tutorials on how to write the php for this? _ Messenger Café — open for fun 24/7. Hot games, cool activities served daily. Visit now. http://cafemessenger.com?ocid=TXT_TAGLM_AugWLtagline---End Message--- ---BeginMessage--- Whether or not it's good practice depends on who you ask. :-) Every table should have a primary key. Primary keys, however, may span multiple columns. That's perfectly legal. In some cases that primary key may span every column, but generally that's a sign of bad design unless you're talking about a table that just relates one table to another (many to many relation). The question is whether it's better to have a surrogate key[1]. That is, a unique integer value that has no meaning itself beyond being a unique key. For example, in pretty much any authentication system the username will be unique, and therefore could easily be used as the primary key. Other tables, then, would reference back to the user table using the username as the foreign key. There's pros and cons to surrogate keys over natural keys. See more links below that I don't feel like repeating[2]. Personaly I tend toward surrogate keys in most cases for entities, but not for relationships. In your case, then, no, I would not have a surrogate key on the membersleagues table. Instead I'd define (game_id, member_id) as the primary key. You can absolutely then DELETE from membersleagues WHERE game_id=4 AND member_id=3. Or just delete by one or the other. You don't have to have a primary key defined in order to be able to DELETE, it's just frequently simpler if you do. You can write a WHERE clause on anything. In practice, I generally find it easier to do a delete/rebuild than to try and track an extra surrogate key. That is, I'd do something like: $db-query(DELETE FROM foo WHERE thing_id=5); foreach ($foo-things as $thing_id) { $db-query(INSERT INTO foo (foo_id, thing_id) VALUES (5, $thing_id)); } (Actually I wouldn't do that. I'd use prepared statements because just inserting the variable into the string like that is a security risk. Don't do it. It's just easier to explain without the prepared statement for now.) That should be fine
php-general Digest 20 Aug 2007 02:01:16 -0000 Issue 4971
php-general Digest 20 Aug 2007 02:01:16 - Issue 4971 Topics (messages 261014 through 261028): Re: Cookies and sent headers 261014 by: Nisse Engström Re: Redirection with header (was Re: [PHP] Cookies and sent headers) 261015 by: tedd 261025 by: Wouter van Vliet / Interpotential Re: getting from one table listing from another 261016 by: tedd 261017 by: Stut 261018 by: Jay Blanchard 261019 by: Larry Garfield 261022 by: tedd 261023 by: Jay Blanchard Render fonts 261020 by: Emil Edeholt 261021 by: Al 261024 by: zerof 261028 by: Hamza Saglam Re: iterating and changing value of an array using foreach and references - PHP 5.2.3 261026 by: Sean Pringle Switch To VoIPTelco And Save! 261027 by: VoIPTelco.net Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- On Sat, 18 Aug 2007 17:03:35 +0200, M. Sokolewicz wrote: The reason why setting cookies for you doesn't work is because of the way a HTTP response is structured. It consists of 2 parts: header and body separated by 2 new lines (\n\n). It is _required_ that _all_ headers come _before_ the body. Cookies are actually headers (a Actually, it is perfectly possible (in theory) to send most headers _after_ the body. See RFC 2616, sections 14.40, 3.6.1 and 14.39. I don't think it is possible with (non-nph) PHP though. /Nisse ---End Message--- ---BeginMessage--- At 8:52 AM +0200 8/19/07, Otto Wyss wrote: In my case I could easilly do without redirection but just exit and fall back on the calling page. Yet I want to remove the login page from the browser history. Does the header function have the same effect? O. Wyss: Instead of messing with the user's browser (not good IMO), why not use $_SESSION and make it such that if the user selects the log-on page again, they are redirected to another page? You don't even need header() to do that. Here's an example: http://webbytedd.com/bb/one-time You will only see that page only once -- unless you find a way to clear the session. The process is simply to set a session variable and allow the user to see the page once. Upon returning, the session variable is checked and if it is not null, then the user is redirected to another page like so: if($visit != null) { ob_clean(); include('a.php'); exit(0); } Very simple. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- What you're proposing, is to actually display some content on another page then were the content is originally intended? I'm sorry, but I would consider that 'bad practice'. To me, it makes perfect sense that you don't want to leave the user on the page where login was originally handled. For various reasons. One very obvious would be the 'refresh thing', where your browser asks the user if they want to send the form again. Quite annoying. Then, what about bookmarks? ... I would definately go for the Location: header solution! On 19/08/07, tedd [EMAIL PROTECTED] wrote: At 8:52 AM +0200 8/19/07, Otto Wyss wrote: In my case I could easilly do without redirection but just exit and fall back on the calling page. Yet I want to remove the login page from the browser history. Does the header function have the same effect? O. Wyss: Instead of messing with the user's browser (not good IMO), why not use $_SESSION and make it such that if the user selects the log-on page again, they are redirected to another page? You don't even need header() to do that. Here's an example: http://webbytedd.com/bb/one-time You will only see that page only once -- unless you find a way to clear the session. The process is simply to set a session variable and allow the user to see the page once. Upon returning, the session variable is checked and if it is not null, then the user is redirected to another page like so: if($visit != null) { ob_clean(); include('a.php'); exit(0); } Very simple. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Interpotential.com Phone: +31615397471 ---End Message--- ---BeginMessage--- At 6:12 PM -0500 8/18/07, Jay Blanchard wrote: [snip] I know this is kinda crazy but I need it :P I have one table that lists name's and I have another table that has the name's and points I want to know how to list the name's of the first table by the points of the second table [/snip] Not crazy, pretty standard from a
Re: [PHP] Cookies and sent headers
M. Sokolewicz wrote: On a sidenote, 99% of the world never calls ob_flush (or any such function) since PHP flushes the buffer automatically at the end of its execution. I'll keep the ob_end_flush just for showing what's going on, but thanks for the hint. The reason why setting cookies for you doesn't work is because of the way a HTTP response is structured. It consists of 2 parts: header and body separated by 2 new lines (\n\n). It is _required_ that _all_ headers come _before_ the body. Cookies are actually headers (a set-cookie: [...] header) aswell as any headers set via php's header() function. Any output made by the script (be it a single whitespace, a bunch of text, etc.) will automatically flush the headers, followed by the separator (\n\n) followed by the specified output. After that has been sent, everything outputted will be dumped into the body of the response (simply because you can't go back to the headers which were already sent earlier), so you can't set cookies (which are headers themselves). Thanks, now it's understandable. So, why does output buffering help here? Simply put, instead of dumping headers and any other output directly to the client, PHP buffers it all into memory. As such, since it hasn't been sent yet, PHP can still alter/add headers even though it also has body-output. Once it receives the command, PHP will send all headers, the separator and the output to the client. This is done when PHP encounters an ob_flush or ob_end_flush call, _and_ when the script has finished execution automatically. The documentation seems pretty clear to me, however, if you feel it should be clarified better, feel free to send a patch to the [EMAIL PROTECTED] list. - Tul O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)
M. Sokolewicz wrote: emits). Now, I'm not going to go into how redirecting that way won't work (or at least shouldn't), but a hint would be to do it properly using header('Location: [...]') instead. I'm aware that using Javascript within a PHP code block doesn't seems logical yet I haven't known header ('Location...). In my case I could easilly do without redirection but just exit and fall back on the calling page. Yet I want to remove the login page from the browser history. Does the header function have the same effect? O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: www.soongy.com
Hi, Sorry for late response. The main idea is in sending text messages using email, SMS, our messaging service. Also you can hold some web notes there. I agree it is not good for now. This is just start of this project. I am trying to do one step to WEB2 world. You can look http://www.netvibes.com , http://www.pageflakes.com/ I mean DHTML, PHP, AJAX can do fantastic things If you have better idea tell me please Thank you Dan very much Best, Gevorg -Original Message- From: Dan [mailto:[EMAIL PROTECTED] Sent: Saturday, August 18, 2007 4:05 AM To: php-general@lists.php.net Subject: [PHP] Re: www.soongy.com What is this supposed to be exactly? I gather from looking at it quickly that uses can signup, then send messages to other signed up users right? So it's like email, but you can only send messages to other people that signup, and login through that specific webpage. Forgive me but I don't see the appeal, what is this for? - Dan Gevorg Harutyunyan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am Gevorg. I just wanted to introduce you my new PHP based work here www.soongy.com http://www.soongy.com/ . It is working on PHP and MySQL and here is used DHTML, AJAX. Thank you very much. Waiting for your response Regards, Gevorg -- 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] Cookies and sent headers
On Sat, 18 Aug 2007 17:03:35 +0200, M. Sokolewicz wrote: The reason why setting cookies for you doesn't work is because of the way a HTTP response is structured. It consists of 2 parts: header and body separated by 2 new lines (\n\n). It is _required_ that _all_ headers come _before_ the body. Cookies are actually headers (a Actually, it is perfectly possible (in theory) to send most headers _after_ the body. See RFC 2616, sections 14.40, 3.6.1 and 14.39. I don't think it is possible with (non-nph) PHP though. /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)
At 8:52 AM +0200 8/19/07, Otto Wyss wrote: In my case I could easilly do without redirection but just exit and fall back on the calling page. Yet I want to remove the login page from the browser history. Does the header function have the same effect? O. Wyss: Instead of messing with the user's browser (not good IMO), why not use $_SESSION and make it such that if the user selects the log-on page again, they are redirected to another page? You don't even need header() to do that. Here's an example: http://webbytedd.com/bb/one-time You will only see that page only once -- unless you find a way to clear the session. The process is simply to set a session variable and allow the user to see the page once. Upon returning, the session variable is checked and if it is not null, then the user is redirected to another page like so: if($visit != null) { ob_clean(); include('a.php'); exit(0); } Very simple. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getting from one table listing from another
At 6:12 PM -0500 8/18/07, Jay Blanchard wrote: [snip] I know this is kinda crazy but I need it :P I have one table that lists name's and I have another table that has the name's and points I want to know how to list the name's of the first table by the points of the second table [/snip] Not crazy, pretty standard from a database point of view; SELECT a.name, b.points FROM table a LEFT OUTER JOIN table b ON(a.name = b.name) This only works if the name in table a matches a name in table b. Then why use a JOIN? It's my understanding that JOINs are used to included unmatched rows -- am I wrong? Wouldn't this be simpler? SELECT a.name, b.points FROM table_name a, table_name_points b WHERE a.name = b.name Besides, all that JOIN stuff makes my head hurt. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting from one table listing from another
tedd wrote: At 6:12 PM -0500 8/18/07, Jay Blanchard wrote: [snip] I know this is kinda crazy but I need it :P I have one table that lists name's and I have another table that has the name's and points I want to know how to list the name's of the first table by the points of the second table [/snip] Not crazy, pretty standard from a database point of view; SELECT a.name, b.points FROM table a LEFT OUTER JOIN table b ON(a.name = b.name) This only works if the name in table a matches a name in table b. Then why use a JOIN? It's my understanding that JOINs are used to included unmatched rows -- am I wrong? Wouldn't this be simpler? SELECT a.name, b.points FROM table_name a, table_name_points b WHERE a.name = b.name Besides, all that JOIN stuff makes my head hurt. Maybe so, but what you've done there is an implicit join. I'd recommend you learn as much as you can about join operations - they can make life a lot easier and more efficient. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getting from one table listing from another
[snip] At 6:12 PM -0500 8/18/07, Jay Blanchard wrote: [snip] I know this is kinda crazy but I need it :P I have one table that lists name's and I have another table that has the name's and points I want to know how to list the name's of the first table by the points of the second table [/snip] Not crazy, pretty standard from a database point of view; SELECT a.name, b.points FROM table a LEFT OUTER JOIN table b ON(a.name = b.name) This only works if the name in table a matches a name in table b. Then why use a JOIN? It's my understanding that JOINs are used to included unmatched rows -- am I wrong? [/snip] Exactly. If there is a name in table a that has no points in table b you will see the name from a and a NULL from b. If you only want names that have points you can use the implicit join that you illustrate. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting from one table listing from another
On Sunday 19 August 2007, tedd wrote: Not crazy, pretty standard from a database point of view; SELECT a.name, b.points FROM table a LEFT OUTER JOIN table b ON(a.name = b.name) This only works if the name in table a matches a name in table b. Then why use a JOIN? It's my understanding that JOINs are used to included unmatched rows -- am I wrong? Wouldn't this be simpler? SELECT a.name, b.points FROM table_name a, table_name_points b WHERE a.name = b.name Besides, all that JOIN stuff makes my head hurt. Cheers, tedd There are various kinds of JOINs. The most common you'll actually use are INNER JOIN and LEFT OUTER JOIN. You should use an explicit INNER JOIN over an implicit join (what you have above) for two main reasons: 1) It's clearer and more obvious what you're doing. 2) The syntax for implicit joins changed very slightly in MySQL 5, so code using them *may* in some circumstances, break when you upgrade. (We discovered this the hard way at work when dealing with some legacy code.) 3) I believe it's more cross-database standardized (nobody expects the Spanish Inquisition!) INNER JOINs return rows only if there are matching values in both tables. LEFT OUTER JOINs return rows if there are matches in just the first (left) table, and fill in NULL values for the columns from the right table if nothing matches. For more information, consult the MySQL manual or a good MySQL forum. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Render fonts
Hi I would like to render some fonts into images, for captions on a site. What tools should I use to get the best looking render? Do you guys use the built-in tools PHP has, or are there third party libraries that does a better job? Thanks! Kind regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Render fonts
Take a look at the PHP Imagick library API for Imagemagick. Imagemagick will create as good quality fonts as you like. Here is an example of one I've done in a test file. http://www.ridersite.org/imagemagick/Imagick.php Emil Edeholt wrote: Hi I would like to render some fonts into images, for captions on a site. What tools should I use to get the best looking render? Do you guys use the built-in tools PHP has, or are there third party libraries that does a better job? Thanks! Kind regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting from one table listing from another
At 12:56 PM -0500 8/19/07, Larry Garfield wrote: On Sunday 19 August 2007, tedd wrote: Wouldn't this be simpler? SELECT a.name, b.points FROM table_name a, table_name_points b WHERE a.name = b.name There are various kinds of JOINs. The most common you'll actually use are INNER JOIN and LEFT OUTER JOIN. You should use an explicit INNER JOIN over an implicit join (what you have above) for two main reasons: 1) It's clearer and more obvious what you're doing. 2) The syntax for implicit joins changed very slightly in MySQL 5, so code using them *may* in some circumstances, break when you upgrade. (We discovered this the hard way at work when dealing with some legacy code.) 3) I believe it's more cross-database standardized (nobody expects the Spanish Inquisition!) INNER JOINs return rows only if there are matching values in both tables. LEFT OUTER JOINs return rows if there are matches in just the first (left) table, and fill in NULL values for the columns from the right table if nothing matches. Larry: Ok, that makes sense. The term JOIN means to consider/include the contents from more than one table. The INNER term is for items that are common between the tables (i.e., intersection) and the OUTER term is to consider the items of one table regardless of their presence in another. However, the LEFT and RIGHT will take me a while to figure out. Thanks, for your explanation. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getting from one table listing from another
[snip] However, the LEFT and RIGHT will take me a while to figure out. [/snip] FROM table a LEFT OUTER JOIN table b ON(a.column = b.column) Just follow the order tedd, a is on the left and b is on the right LEFT OUTER - a - b (what may be in a might not be in b) a - b - RIGHT OUTER (what may be in b might not be in a) FROM table a INNER JOIN table b ON(a.column = b.column) a - INNER JOIN - b (only where in a and b) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Render fonts
I would like to render some fonts into images, for captions on a site. What tools should I use to get the best looking render? Do you guys use the built-in tools PHP has, or are there third party libraries that does a better job? ... http://www.educar.pro.br/en/a/gdlib/ -- zerof http://www.educar.pro.br/ Apache - PHP - MySQL - Boolean Logics - Project Management -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)
What you're proposing, is to actually display some content on another page then were the content is originally intended? I'm sorry, but I would consider that 'bad practice'. To me, it makes perfect sense that you don't want to leave the user on the page where login was originally handled. For various reasons. One very obvious would be the 'refresh thing', where your browser asks the user if they want to send the form again. Quite annoying. Then, what about bookmarks? ... I would definately go for the Location: header solution! On 19/08/07, tedd [EMAIL PROTECTED] wrote: At 8:52 AM +0200 8/19/07, Otto Wyss wrote: In my case I could easilly do without redirection but just exit and fall back on the calling page. Yet I want to remove the login page from the browser history. Does the header function have the same effect? O. Wyss: Instead of messing with the user's browser (not good IMO), why not use $_SESSION and make it such that if the user selects the log-on page again, they are redirected to another page? You don't even need header() to do that. Here's an example: http://webbytedd.com/bb/one-time You will only see that page only once -- unless you find a way to clear the session. The process is simply to set a session variable and allow the user to see the page once. Upon returning, the session variable is checked and if it is not null, then the user is redirected to another page like so: if($visit != null) { ob_clean(); include('a.php'); exit(0); } Very simple. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Interpotential.com Phone: +31615397471
Re: [PHP] iterating and changing value of an array using foreach and references - PHP 5.2.3
On 8/18/07, Yashesh Bhatia [EMAIL PROTECTED] wrote: Hi, Here's an interesting observation i noticed while using foreach to iterate on arrays using references for it's values. - PHP version $ php -v PHP 5.2.3 (cli) (built: Jun 8 2007 14:31:21) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies - Source code ?php // initialize array $cat1 = array(); $cat1[15] = array('tid' = 15, 'ar_needed' = 'no'); $cat1[16] = array('tid' = 16, 'ar_needed' = 'no'); $cat1[17] = array('tid' = 17, 'ar_needed' = 'no'); // print it print \n\$cat1 = ; print_r($cat1); print \n; // iterate using foreach and reference foreach ($cat1 as $k = $v) { if ($k == 15) { $v['ar_needed'] = 'yes'; // dummy change } } // print array print \n\$cat1 = ; print_r($cat1); print \n; At this point, $v is still a reference to $cat1[17]. Try: unset($v); // reiterate foreach ($cat1 as $k = $v) { print \$k = $k\n; print \$v = ; print_r($v); print \n; } ? - OUTPUT $cat1 = Array ( [15] = Array ( [tid] = 15 [ar_needed] = no ) [16] = Array ( [tid] = 16 [ar_needed] = no ) [17] = Array ( [tid] = 17 [ar_needed] = no ) ) $cat1 = Array ( [15] = Array ( [tid] = 15 [ar_needed] = yes ) [16] = Array ( [tid] = 16 [ar_needed] = no ) [17] = Array ( [tid] = 17 [ar_needed] = no ) ) $k = 15 $v = Array ( [tid] = 15 [ar_needed] = yes ) $k = 16 $v = Array ( [tid] = 16 [ar_needed] = no ) $k = 17 $v = Array ( [tid] = 16 [ar_needed] = no ) - As seen in the above output all the print statements give expected output except the last set in the 2nd iteration $k = 17 $v = Array ( [tid] = 16 [ar_needed] = no ) the $k looks fine but the $v is not correct for some reason. Any clue what could be wrong here ?. Also, in the 2nd iteration of the name of the variable is changed from $v to $v1 it displays correctly $k = 17 $v1 = Array ( [tid] = 17 [ar_needed] = no ) After the first loop, $v is still a reference to $cat1[17]. Each time around the last loop, assigning again to $v will overwrite $cat1[17]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Render fonts
Hi Emil, Just an alternative solution you may want to consider.. Rather than converting your captions/headings to images, you can also use the sIFR Image replacement technique. Quote from the the author's description: sIFR is meant to replace short passages of plain browser text with text rendered in your typeface of choice, regardless of whether or not your users have that font installed on their systems. It accomplishes this by using a combination of javascript, CSS, and Flash. You can find more details on: http://www.mikeindustries.com/sifr/ and a demo page is located at http://www.mikeindustries.com/blog/files/sifr/2.0/ . Regards, Hamza Emil Edeholt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I would like to render some fonts into images, for captions on a site. What tools should I use to get the best looking render? Do you guys use the built-in tools PHP has, or are there third party libraries that does a better job? Thanks! Kind regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)
At 10:40 PM +0200 8/19/07, Wouter van Vliet / Interpotential wrote: What you're proposing, is to actually display some content on another page then were the content is originally intended? I'm sorry, but I would consider that 'bad practice'. To me, it makes perfect sense that you don't want to leave the user on the page where login was originally handled. For various reasons. One very obvious would be the 'refresh thing', where your browser asks the user if they want to send the form again. Quite annoying. Then, what about bookmarks? ... No, what I had proposed was an alternate method to accomplish what you said you wanted. But, it appears that my efforts and the demo did not receive sufficient attention for you to understand what wass being presented. Instead, you tell me that what I've shown you is bad practice -- interesting. You said that you wanted to remove login from the browser history, which is screwing around with the user's browser and is clearly bad practice. My method simply stops the user from visiting the same page more than once during a session and leaves their browser data alone -- nothing bad practice about that! AFTER my demo runs, if you repeatedly refresh the page you are directed to, then certainly that would become annoying. But that wasn't the intent, nor part of the demo, which you clearly didn't read and obviously didn't understand. As far as bookmarking the page, but of course you can bookmark the page! Did you even try? Oh well, so much for trying to help someone understand sessions. As my mother often said No good deed ever goes unpunished. If you had simply said, I don't understand, please explain; or asked a question or two; or said thanks, but no thanks, I'm going to do it another way, then that would have been fine. But to say that the demo I prepared for you exhibited bad practice, especially when you are absolutely friggen clueless as to what it is doing, is a bit too much -- I'll be sure to pass over your post in the future. tedd --- I would definately go for the Location: header solution! On 19/08/07, tedd [EMAIL PROTECTED] wrote: At 8:52 AM +0200 8/19/07, Otto Wyss wrote: In my case I could easilly do without redirection but just exit and fall back on the calling page. Yet I want to remove the login page from the browser history. Does the header function have the same effect? O. Wyss: Instead of messing with the user's browser (not good IMO), why not use $_SESSION and make it such that if the user selects the log-on page again, they are redirected to another page? You don't even need header() to do that. Here's an example: http://webbytedd.com/bb/one-time You will only see that page only once -- unless you find a way to clear the session. The process is simply to set a session variable and allow the user to see the page once. Upon returning, the session variable is checked and if it is not null, then the user is redirected to another page like so: if($visit != null) { ob_clean(); include('a.php'); exit(0); } Very simple. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Interpotential.com Phone: +31615397471 -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is this a bug?
I dont know what is happening... Can somebody clarify the situation for me? here is the situation: i have 3 files: class.php foo.php bar.php // - class.php class globalactions { function include_file($module) { if ($module) { return (modules/.$module./templates/.$module..php); } else { return include(modules/main/templates/index.php); } } } // - foo.php include lib/clients.class.php; $clients = new clients(); //instatiating the clients class // - bar.php include 'class.php'; $globalactions = new globalactions (); include $globalactions-include_file(foo); //return - modules/foo/templates/foo.php var_dump($clients); //will return the object OK. All this works. but i want make some changes. Well.. What i want to do is this: class.php: change the line: return (modules/.$module./templates/.$module..php); to: return include (modules/.$module./templates/.$module..php); and in the bar.php: // - bar.php include 'class.php'; $globalactions = new globalactions (); $globalactions-include_file(foo); //return - include modules/foo/templates/foo.php // OK. This works. var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!? What is happening? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variables
Hi, I want create a variable based in another variable. Example: $foo (a simple variable); $myvar_foo Does it possible? Thanks Augusto Morais -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] This is a bug?
I dont know what is happening... Can somebody clarify the situation for me? here is the situation: i have 3 files: class.php foo.php bar.php // - class.php class globalactions { function include_file($module) { if ($module) { return (modules/.$module./templates/.$module..php); } else { return include(modules/main/templates/index.php); } } } // - foo.php include lib/clients.class.php; $clients = new clients(); //instatiating the clients class // - bar.php include 'class.php'; $globalactions = new globalactions (); include $globalactions-include_file(foo); //return - modules/foo/templates/foo.php var_dump($clients); //will return the object OK. All this works. but i want make some changes. Well.. What i want to do is this: class.php: change the line: return (modules/.$module./templates/.$module..php); to: return include (modules/.$module./templates/.$module..php); and in the bar.php: // - bar.php include 'class.php'; $globalactions = new globalactions (); $globalactions-include_file(foo); //return - include modules/foo/templates/foo.php // OK. This works. var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!? problem: When the method(include_file) return include FILE the $client object stay NULL but when the same method only return FILE : include $globalactions-include_file(foo); the $client object isnt empty. What is happening??!?!? I dont have any idea... Thanks Augusto Morais -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variables
Augusto Morais wrote: I want create a variable based in another variable. Example: Maybe this will give you some ideas?: http://us3.php.net/manual/en/language.variables.variable.php Good luck! Cheers, Micky -- Wishlists: http://snipurl.com/1gqpj Switch: http://browsehappy.com/ BCC?: http://snipurl.com/w6f8 My: http://del.icio.us/mhulse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php