Re: [PHP-DB] [Newbie] switch, if, or something to choose queries and echo formatting--PLEASE help
So I attempted to do this: switch($_GET[page]){ $count=1; $table = mysql_query(SELECT * FROM thumbs,$db); echo(table border='0' cellspacing='1' cellpadding='1' width='300' align='center'tr); while ( $r = mysql_fetch_array($table) ) : if ($count==4){ echo (/trtrtd span='4'img src='images/spacer.gif' height='10' width='1'/td/trtr); $count=1; }else{ $id=$r[id]; $pic=$r[pic]; $thumb=$r[thumb]; $pname=$r[pname]; $pcom=$r[pcom]; echo(td align='left' valign='top' width='100'a href='$pic' target='blank'img src='$thumb' border='0' align='left'/abr clear='all'b$pname/bbri$pcom/i/td); $count++; } endwhile; break; Which did not work. I wondered if that was too much for the case or if you couldn't nest. PHP.net says The switch statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. PHP continues to execute the statements until the end of the switch block, or the first time it sees a break statement. Which made me think otherwise--but, hey, something's wrong. Yip, the logic of the switch statement. You simply don't have a case statement. I must confess I don't understand fully what you are trying to do yet but I don't think this is the way to go. The above extract should be enough to see what I mean... Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. You don't have one so... it won't ever start! Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB]
excuse me pls., i am putting a question which is not related to this forum but i am sure somebody will help me i want to know whether in PHP submenu can be created under menu so that user put his mouse over the menu and submenu automatically displayed. with best wishes balwant -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB]
Hello balwantsingh: STFW: javascript menu Good Luck! On Sat, 25 Sep 2004 15:38:14 +0530, balwantsingh [EMAIL PROTECTED] wrote: excuse me pls., i am putting a question which is not related to this forum but i am sure somebody will help me i want to know whether in PHP submenu can be created under menu so that user put his mouse over the menu and submenu automatically displayed. with best wishes balwant -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Pablo M. Rivas. http://pmrivas.ipupdater.com http://www.r3soft.com.ar --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[no subject]
From [EMAIL PROTECTED] Sat Sep 25 20:43:11 2004 Message-ID: [EMAIL PROTECTED] Date: Sat, 25 Sep 2004 14:23:21 -0700 From: Cole S. Ashcraft [EMAIL PROTECTED] User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=5.0 tests= version=2.20 X-Spam-Level: Subject: [PHP-DB] Short Names Is it considered bad / sloppy to define the short names of varibales at the beginning of your code so you don't have to type out $_REQUEST[variable] or $HTTP_REQUEST_VARS[variable]? Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Short Names
IMHO, no -- it makes the code more readable. I'd also recommend making sure that variable names match their purpose (so, for instance, if you have a variable that contains a mailing address, use $mailing_addr, or if you have a variable that contains an array of recipes, use $arr_recipes). The more you can make your code readable, the better. Always keep in mind the other people that may read your code -- this, in general, means commenting and using good sense in variable names. It'll help you later for when you haven't touched the code in a year or two and need to know what you wrote and why... Hope this helps. -- Peter Ellis - [EMAIL PROTECTED] Web Design and Development Consultant naturalaxis | http://www.naturalaxis.com/ On Sat, 2004-09-25 at 14:23 -0700, Cole S. Ashcraft wrote: Is it considered bad / sloppy to define the short names of varibales at the beginning of your code so you don't have to type out $_REQUEST[variable] or $HTTP_REQUEST_VARS[variable]? Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: switch, if, or something to choose queries and echo formatting--PLEASE help
Actually, there was a case statment...originally. I deleted that code and was simply putting back together what I'd done and trashed. And I ended up leaving it out in the e-mail (I thought maybe that HAD been part of the problem and checked, but the case statements are there in my current version). To summarize ...in more detail... I have a 'personal portfolio site' that contains a variety of creative endeavors, written and visual. It has 6 major sections. @VR (Which contains 'about the site', 'copyrights and credits', 'updates', 'donate', etc.) Design (Which contains 'animation', 'photographs', 'drawings', 'computer', and 'web') Compose (Which contains 'poetry', 'prose', 'essays', 'fanfiction', and 'tutorials') Memoir (Which contains 'biography', 'resume', 'pictures', 'weblog', 'web journal', 'album') Unleash (Which contains 'downloads', 'layouts', 'graphics', 'tutorials', 'features', and 'forum') Connect (Which contains various ways to contact me and a bunch of links) In my head these are separate. Most likely I will make most of the pages in @VR, some in Connect, and one or two in Memoir simply with HTML, because they don't change. However, the Design pages, Compose pages, Unleash pages, and Connect Links pages have become far too cumbersome to keep up with by manually updating. I haven't changed my layout in about two years because the idea of making another 100 HTML files makes me shudder. If I can manage, with my tests, to figure out how to get the whole concept to work, I will make the full database. As of now I only have a few test tables set up. But my idea is to basically make each page that needs a database-driven content its own table. The layout I'm working with has a drop-down menu (not written by me), with images as buttons for the links. I don't think it's the sort of thing that I can add to a table and have the database deal with, therefore I am literally typing the link on my test page: a href=subsections.php?section=designimage/a OR a href=subsections.php?page=animationimage/a OR a href=subsections.php?section=design?page=animationimage/a (Only the pages are links, the sections are just for organization and do not need pages.) To reitarate, I've currently got a link that reads: a href=subsections.php?section=design?page=animationimage/a and subsections.php says (and this is all it says): ?php //section cases switch($_GET[section]){ case design: include(design.php); break; default: print(Error); } ? then, design.php says (and this is imbedded in where I want the content to go): ?php //page cases switch($_GET[page]){ case animation: $page=thumbs; break; default: print(Error); } $count=1; $table = mysql_query(SELECT * FROM $page,$db); echo(table border='0' cellspacing='1' cellpadding='1' width='300' align='center'tr); while ( $r = mysql_fetch_array($table) ) : if ($count==4){ echo (/trtrtd span='4'img src='images/spacer.gif' height='10' width='1'/td/trtr); $count=1; }else{ $id=$r[id]; $pic=$r[pic]; $thumb=$r[thumb]; $pname=$r[pname]; $pcom=$r[pcom]; echo(td align='left' valign='top' width='100'a href='$pic' target='blank'img src='$thumb' border='0' align='left'/abr clear='all'b$pname/bbri$pcom/i/td); $count++; } endwhile; echo (/tr/table); ? If I could get it to work like I wanted, I would set the 'section' designation based on what sort of format I wanted the table's results to be in. For any page using thumbnails in an image-gallery-like table, I would set the case to include 'design.php', for any lists of stories or poems, I would use 'compose.php'. Then design.php would find out what *particular* page needs to display and substitute the appropriate table name. Seems pretty simple to me. Like I said, though, I'm not too smart about this, and this may be totally NOT the way to achieve it...however, if someone knows how to achieve it, I would appreciate the input. - (R)hy http://www.virtualrevolution.net .switch.it.on. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.766 / Virus Database: 513 - Release Date: 9/17/2004 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] LAMP uploaded file permissions preventing db upload
On my LAMP system, I am using the http post method for uploading files from the browser into the /tmp directory. Then using the MySQL load file command to load that file into the database. Well at least I am trying to. The upload to the /tmp directory is working fine, but due to file permissions, the load into the db is failing. Apache/PHP is running as nobody:nobody (I have tried different groups with no luck) MySQL is running as mysql:mysql permissions on /tmp are currently: drwxrwxrwx 12 root root 4096 Sep 25 22:17 tmp permissions on a file that has been uploaded to /tmp are currently: -rw---1 nobody nobody 255775 Sep 25 22:17 test.csv If I change the permissions on the file to world-readable the db load works as expected. Any ideas on how to get Apache/PHP to write the file to /tmp as world-readable would be greatly appreciated.Of course if I should be taking a different approach, I would be welcome to recommendations there as well. Thanks Will -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php