Re: [PHP] image inventoryer
"Kirk Bailey" wrote in message news:4f7e5d2f.3050...@howlermonkey.net... > jim, I am a novice at this language as I said. > Then you are taking on too big of a task. When I decided to pick up some web programming skills I bought a $50 book/manual on learning PHP and another on MySQL. I read them - cover to cover. Then I made up simple tasks to develop in order to LEARN how it's actually done. Sounds like you not only want someone to program it for you, but probably help you implement it too. Sure - I or someone with time on their hands - could reply back with a couple hundred lines of code and give you your answer. Then what would you have gained? Hey - I gave you the outline of how this goal of yours could be accomplished. No need for your own pseudo-code at this point. Take mine and go do some research! Have fun! Then come back for clarification on what you're doing wrong once you have some actual code written. >> > And were people this nice to you when YOU asked beginner questions? >> When I asked beginner questions, it was AFTER I had written something and ran into a roadblock. NOT before I had set pen to paper. You're asking how to get to California without having consulted a map yet. This site will be there for you when you have a problem - don't worry. Me included, not that my input is that worthy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Fri, Apr 6, 2012 at 8:34 AM, Jim Giner wrote: > "Kirk Bailey" wrote in message > news:4f7e5d2f.3050...@howlermonkey.net... > > jim, I am a novice at this language as I said. > > > > Then you are taking on too big of a task. > > When I decided to pick up some web programming skills I bought a $50 > book/manual on learning PHP and another on MySQL. I read them - cover to > cover. Then I made up simple tasks to develop in order to LEARN how it's > actually done. Sounds like you not only want someone to program it for > you, > but probably help you implement it too. Sure - I or someone with time on > their hands - could reply back with a couple hundred lines of code and give > you your answer. Then what would you have gained? > > Hey - I gave you the outline of how this goal of yours could be > accomplished. No need for your own pseudo-code at this point. Take mine > and go do some research! Have fun! Then come back for clarification on > what you're doing wrong once you have some actual code written. > > >> > > And were people this nice to you when YOU asked beginner questions? > >> > When I asked beginner questions, it was AFTER I had written something and > ran into a roadblock. NOT before I had set pen to paper. You're asking > how > to get to California without having consulted a map yet. This site will be > there for you when you have a problem - don't worry. Me included, not that > my input is that worthy. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I googled "php show images in folder" and lo and behold the first was was a script almost exactly what you are wanting to do
Re: [PHP] image inventoryer
"David OBrien" wrote in message news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com... >> > I googled "php show images in folder" and lo and behold the first was was > a script almost exactly what you are wanting to do > Damn - now the OP missed a golden opportunity to do some research! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Apr 6, 2012 9:51 AM, "Jim Giner" wrote: > > "David OBrien" wrote in message > news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com... > >> > > I googled "php show images in folder" and lo and behold the first was was > > a script almost exactly what you are wanting to do > > > Damn - now the OP missed a golden opportunity to do some research! :) > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > It's been my experience if they haven't even used google to see what premade scripts are available to do something similar then the research ain't gonna happen. They'd just post on ee or another forum where they could get the answer easier
Re: [PHP] image inventoryer
On Apr 5, 2012, at 10:26 PM, Kirk Bailey wrote: > I need a page that will live in a directory and list all image files in > there. That is, the page has > > tags emitted in it's structure, one per file in the directory with a saught > file type- .png, .gif, .jpg, you get the idea. > this should use relative addressing so once the tool is built I can use it in > other directories as is. > > Now ai am still a novice at p[hp, how can I do this ? > > -- > end > > Very Truly yours, > - Kirk Bailey, Kirk: That will be a good exercise for you. If you want help, then show us something where you did something other than ask for the code. For example, show us *your* code (or attempt) to list all the files in a directory. That's pretty simple. After you do that, then we can move on to the next step. Please realize we are not here to write code for you but rather to help you with *your* code. Cheers, tedd _ tedd.sperl...@gmail.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach
On Thu, Apr 5, 2012 at 3:15 PM, Ethan Rosenberg wrote: > I know I am missing something fundamental - but I have no idea where to > start to look. It's really difficult to figure out what you're asking. Your code snippets and associated output seem all jumbled up. It would help greatly if they were presented in order. > Here are code snippets: > > I have truncated the allowed_fields to make it easier to debug. > > $allowed_fields = array( 'Site' =>'POST[Site]', 'MedRec' =>> > '$_POST[MedRec]', 'Fname' => '$_POST[Fname]' ); > echo "post #1\n"; > print_r($_POST); Here, do you realize that you are setting each element of the array to the exact contents of each string, i.e., there will be no variable interpolation? If that's what you intend to do, great, but read on... > RESPONSE: > > post #1 > Array > ( > [Site] => AA > [MedRec] => 10002 > [Fname] => > [Lname] => > [Phone] => > [Height] => > [welcome_already_seen] => already_seen > [next_step] => step10 > ) Are you expecting something else here, or is the $_POST containing the correct data? > > // $allowed_fields = array("Site", "MedRec", "Fname", "Lname", // previous > statement of $allowed_fields > // "Phone", "Sex", "Height"); I'm not clear why you're showing commented out lines. This looks like output from a statement below. It's much clearer if you put the output below the code. > Key Site, Value POST[Site] > Key MedRec, Value $_POST[MedRec] > Key Fname, Value $_POST[Fname] > foreach ($allowed_fields as $key => $val) { >print "Key $key, Value $val\n"; > } And the above output is exactly what I would expect given how you created the $allowed_fields hash: each of the values was set as an uninterpolated string by using single quotes instead of double quotes. If you really wanted the values, you should not have quoted them at all, but instead quoted the $_POST key names, like so: $allowed_fields = array('Site' => $_POST['Site'], 'MedRec' => $_POST['MedRec'], 'Fname' => $_POST['Fname']); Pay closer attention to what you are quoting and how you are quoting it. > if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' ) $_REQUEST is always fully capitalizes, unless it's your own variable. (If it is, I suggest using another name as it's confusing.) Also, as you seem to know that the field is in the $_POST array, rather than use $_REQUEST, go ahead and just use $_POST. > { > if ($_REQUEST['Sex'] === "0") > { > $sex = 'Male'; > } > else > { > $sex = 'Female'; > } > } This is an opportune time to use a ternary operator. Replace the inner if-else with: $sex = ($_POST['Sex'] === "0") ? 'Male' : 'Female' ; > } ^ Is this an extra closing brace or is it closing something before the snippet? (confusing) > echo "Post#2"; > print_r($_POST); > if(empty($allowed_fields)) What is happening after this line? > //RESPONSE > > Post#2Array > ( > [Site] => AA > [MedRec] => 10002 > [Fname] => > [Lname] => > [Phone] => > [Height] => > [welcome_already_seen] => already_seen > [next_step] => step10 > ) As you have not changed $_POST in any way, this is exactly what you should expect to see. > { > echo "ouch"; > } Is this ^^ what comes after the if(empty statement above? What is it's output? > foreach ( $allowed_fields as $key => $val ) //This is line 198 > { > if ( ! empty( $_POST['val'] ) ) This will always check the value associated with the 'val' entry in $_POST. I'm pretty sure this is not what you want. > { > print "Key $key, Value $val\n"; > $cxn = mysqli_connect($host,$user,$password,$db); > $value = mysql_real_escape_string( $_POST[$fld] ); > $query .= " AND $fld = '$_POST[value]' "; The query will check to see if what ever $fld evaluates to (I don't see where it is set, but maybe somewhere else) and compare it to the *exact* string $_POST[value] -- I doubt that you are storing that in your data base -- at this point I'm not really sure what you want there. > echo "#1 $query"; //never echos the query ^^ it never will, since the Notice and Warning below indicate the for loop is never executed. > } > } > These are the messages I receive on execution of the script: > > Notice: Undefined variable: allowed_fields in /var/www/srchrhsptl5.php on > line 198 > Warning: Invalid argument supplied for foreach() in /var/www/srchrhsptl5.php > on line 198 Is this stretch of code inside a function perhaps? If so, is $allowed_fields declared as a global inside the function? Please send or pastebin more code so we can see it clearly. Generally when a problem like that is reported and it's not obviously a typo or spelling error, the problem is not necessarily at the line itself, but above someplace in the code. > Advice and help, please. My general advice is to pay closer attention to what you're quoting and how you're quoting it, and that case matters in variable names. '$_POST[val]' is the *exact* string '$_POST[val]' -- it does not get any con
Re: [PHP] image inventoryer
On Thu, Apr 5, 2012 at 10:04 PM, Kirk Bailey wrote: > jim, I am a novice at this language as I said. > And were people this nice to you when YOU asked beginner questions? When I ask beginner questions, I spend time doing my homework first. This list is not a class to teach you to write PHP. The people here are not going to hold your hand and feed you spoonfuls of PHP knowledge. Read first. Ask smart questions. There are BOATLOADS of tutorials on PHP on the net, just a google away. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
"tamouse mailing lists" wrote in message news:CAHUC_t-M_dg_D+if01BQm=RPd=GgL7d=naxfadxwybse-nn...@mail.gmail.com... > knowledge. Read first. Ask smart questions. There are BOATLOADS of > tutorials on PHP on the net, just a google away. I like that! "just a google away". :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php