Jump to content

fedoracore

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by fedoracore

  1. check it out-- for now, i've decided that the following is probably just as good as anything else for this project (though i'm still displeased about being stumped on the path stuff) <?phpif(file_exists("offset.php")){include 'offset.php';} else {define('OFFSET','../');}if(file_exists("db.inc")){include 'db.inc';} else {$dbincNeeded = "the db.inc file isn't here!";}if(file_exists("error.inc")){include 'error.inc';} else {$errincNeeded = "the error.inc file isn't here!";}$cssAdjusted = XRO.$StyleSheetPath;?><!-- SNIP --><body><?phpif(isset($dbincNeeded)){ echo "<h1>".$dbincNeeded."</h1>";}if(isset($errincNeeded)){ echo "<h1>".$errincNeeded."</h1>";}?> at least i'll know what's wrong w/ stuff that way-- as i'm terribly forgetful about stuff (ha! i could totally have gotten through about 5 chapters just now, huh?)8-)
  2. right! that's what i'm talking about (i think)... except it's the recursion part that i don't know how to get. how would i "point" to that base dir file, and then "count" those directory offsets, determining how many of the "../" i need to add?there's a cool example at php.net (which ive mod'd just a bit cause it didn't work, not unlike my typo above ;-) <?php// here $path becomes the REQUEST_URI variable// **(see "quote" below for cite) // ** note this is MY mod from the example available at ./reserved.variables.php (the Manual)// more info at http://www.php.net/manual/en/reserved.variables.phpfunction path_to_root($path) { $pathinfo = pathinfo($path); $deep = substr_count($pathinfo['dirname'], "/"); $path_to_root = "./"; for($i = 1; $i <= $deep; $i++) { $path_to_root .= "../"; } return $path_to_root;}$mysterypath = path_to_root($_SERVER["REQUEST_URI"]);// NOTE my mod to the func provided at the Manualecho $mysterypath;?> ..so this gives me some very useful info-- however, something in my brain can't put this to work for my problem above. it seems to be what i need-- but i'm like-- writer's block or something! you can see i've got the info... EDIT:okay, for example: using the above path_to_root() func, i get this output:./../../../../../my file is in:_http://localhost/~myuser/workshop/wsbook/ch04_mynotes/generic-testing-php/offset-testing.php_so, indeed-- the "six offsets" is correct-- but there's no way to use that generic info to help me if i want to keep a file in ./wsbook/ a file which i will "always reference" for the proper offset info? i dunno-- i'm probably taking it way too far. what i'd like is to have a "TEMPLATE" that i could use throughout this "study" i'm doing-- and each time i use the template, i'd like for it to have CSS styling. so this is why i'm trying to do it -- but also for the fact that sometime in the future, this knowledge could come in handy. (i.e. surely WordPress must use some sort of "constant" like this, no? ... maybe not, as i suppose the dir structure doesn't change...) sorry about all this text. it's been bugging me for a while though-- like this is the one thing about path info that i can't seem to "get".EDIT 2:i think the bottom line is it can't be done. if it could be done, then no one would have any problems w/ breadcrumbs and all that for navigation. the bottom line is there must remain some amount of developer "intervention" to modify each file to accomodate for its directory "depth". maybe it can be done-- but probably only through a user-defined function. i dunno...i am curious about the "base.dir" thing, J.S.G. if you care to share what you mean about that.
  3. AT ISSUE HERE:inside ./MyWorkshop/Template.php i wish to link to ./MyWorkshop/css/style.cssin a manner which will be universal, continuing to link to ./MyWorkshop/css/style.css -- even inside of mkdir ./chapter06 ... (a new directory) such as:./MyWorkshop/chapter06/MySQL_examples/File-From-Template.php./MyWorkshop/chapter06/javascript/File2-From-Template.php and so on.i've got a script i use to figure file-names, but i can't think how to "warp it" into giving me what i want in this situation-- yet, the info seems to be there: <?php$process = $_SERVER['PHP_SELF'];$patharray = pathinfo($process);$thispage = rtrim($patharray['basename'], $patharray['extension']);$thispage_rtrim = rtrim($thispage, '.');if(!defined('OFFSETPATH')) {$offsetpath = '../';} else {$offsetpath = OFFSETPATH;// edited 22:02 april11 2007}$StyleSheetFile = $offsetpath.'css/stylesheet.css';?> but -- i don't want to have to fool around w/ that OFFSETPATH stuff. this is fine for a pre-established directory structure where i can define('offsetpath') where needed, but here i'd like to try something new. ideas? thanks.
  4. or the "navigatin menu" in seamonkey right? hmm-- i'm probably confusing that w/ something else. to me, it's not stated quite clearly the purpose at the w3c (so, i guess what they what us to learn at the w3c is ... "this is only for a User Agent or a Robot, and will have no affect on the page functionality..", yet that isn't quite the clear message which comes across to me.)it's additionally confusing for me because of the BASE element seems to be related-- if nothing else-- in terms of location in the Rec. hehe., and it DOES indeed noticeably affect the page navigation.one more "For instance"...have you ever used the PHP.Net "enhanced CHM manual" thing? at the bottom of the pages, if you're not "on-line" the "next" and "prev" buttons are just ??? marks, right? (i'm pulling this from memory, so... could be wrong here easily...)so, wouldn't that indicate that the actual anchors, or -- what we can click on WITHIN the visible page is dynamically generated in some way relevant to LINK ??? (the CHM is probably another situation similar to the Opera nav thng perhaps?... )"... things that make ya go hmmm..." hehethanks for your replies. i guess i'll just throw this one to the robots then....
  5. hello there.i've been trying to figure out how to use the html LINK element for creating document relationships, but from what's listed at the w3C's rec, i don't quite get it... sure, they've got a few examples-- but i couldn't find anything where i can go back and reference my own trial and error and say "oh, okay-- theirs looks like this, and mine looks like this... and..."because, they don't appear to have any real examples there. or-- am i just missing it?to put it another way, take for example, php.netthe documentation uses the "Prev" and "Next" LINK elements to navigate about the documentation. it's my interpretation that it is the same thing which is used in the w3c example, essentially-- however, it just doesn't make sense to me as to "How do we get the link to appear in the page for 'clicking'?"thanks!(EDIT: it didn't post the first time??)
  6. hey Nakor, that did it man! thanks so much.now, why exactly is it that we had to go that route in particular? you mentioned that -- how might i avoid / plan for this in future designs? i'm all about trying to get the db just right, so i like to take advantage of any opportunity-- especially while i'm "down in it" so to speak. no biggie if ya don't have time, but if you do, i'm curious... or maybe you have a URL to an article on the subject?thanks again!!! if y'r ever trav'lin through Appalachia, and ya need some guitar strings, or a Kazoo perhaps... definitely look me up! hehe :)EDIT:Sorry-- but for some reason i'm feeling rather thick-headed about this thing today. I made an image for you to view the structure a bit better. My question: using the return value from the Query developed above (the one which Nakor provided), will i be able to manipulate that particular query, or should i "simultaneously" execute another query for the rest of the data, and then somehow use the results from the first (the COUNT(*) / GROUP query) for formatting a more detailed query? for example, i'd like to see:###########Manufacturer NameCatalog No. | Product (aka 'nickname') | Description | List | Sale | In Stock###########Manufacturer NameCatalog No. | Product (aka 'nickname') | Description | List | Sale | In Stock###########Manufacturer NameCatalog No. | Product (aka 'nickname') | Description | List | Sale | In Stockhence my reasoning for the Query we developed here.EDIT2:hmph. i don't quite get what's different here, but i mod'd the query, like so, and im getting what i want / need now:$AGquery = "SELECT ag_id, COUNT(*), ag_identity, ag_nickname, ag_details FROM aguitar_inventory, aguitar_models WHERE aguitar_inventory.ag_id = aguitar_models.ag_identity GROUP BY ag_id";
  7. hey there! thanks mucho for your input on this issue. i regret to report that it "didn't work"... at least not as nice and clean as shown in Nakor's demo...couple things, please, before we get into specific analysis 1.) Do we all agree that the best approach to solving this problem is through a MySQL function, and NOT something i might want to do to the return data on the PHP side?2.) Something tells me my "failed SQL" isn't really failing as much as it is my chosen use of the query result-- have another look (just in case...) at that next-to-the-last line of my original posted code. the output comes from this multi-dimensional array created by the FOR() loop there at the end. i'm not married to this "M.D. Array" method. it's worked for me elsewhere (for dropdowns n stuff), and it seemed the right idea as a starting point here as well, but perhaps i want to take it from another angle, considering the issue at hand?okay. on to the results: you'll see the SQL, and the results of it's output. I chopped it down to spare you my made-up filler-data, but the results were the same, essentially, no matter if i used justsomeguy's SQL, or this which i consider more a variation on Nakor's proposal: "SELECT ag_id, COUNT(*) FROM aguitar_inventory, aguitar_models WHERE aguitar_inventory.ag_id = aguitar_models.ag_identity GROUP BY ag_identity, cat_id_ag, ag_nickname, ag_details";// ### END //// ### print_r($mulitiDimArray) ###Array( [0] => Array ( [ag_id] => J045 [COUNT(*)] => 1 ) [1] => Array ( [ag_id] => J045 [COUNT(*)] => 1 ) [2] => Array ( [ag_id] => J045 [COUNT(*)] => 1 ) [3] => Array ( [ag_id] => J045 [COUNT(*)] => 1 ) [4] => Array ( [ag_id] => L03 [COUNT(*)] => 1 ) [5] => Array ( [ag_id] => L03 [COUNT(*)] => 1 ) [6] => Array ( [ag_id] => MHD28 [COUNT(*)] => 1 ) [7] => Array ( [ag_id] => MHD28 [COUNT(*)] => 1 )) also tried count(ag_id); COUNT(aguitar_identity), etc., etc... everything came out as value (1)..thanks again!
  8. What is the "standard practice" for grouping multiple returns of the "same item" in a simple join query?Please observe this lines from a working MySQL query Method: $AGquery = "SELECT cat_id_ag, ag_id, ag_identity, ag_nickname, ag_details FROM aguitar_inventory, aguitar_models WHERE aguitar_inventory.ag_id = aguitar_models.ag_identity"; $AGresult = mysql_query($AGquery,$dblink) or die("I could not connect to the database because ".mysql_error()); $this->many=mysql_num_rows($AGresult); for($z=0;$z<$this->many;$z++) { $counter[$z]= mysql_fetch_array($AGresult, MYSQL_ASSOC); } It's technically giving me what i'm asking for, but i don't want it to show all that it does in the ultimate "end-user view". Allow me to elaborate just a bit as it will probably cut-to-the-chase a bit faster: it's an on-line inventory for my friend's guitar store. I want the results to show one-of-each itemcurrently, any duplicate inventory item is printed as part of the $counter array......resulting in an output like:$counter[0] = guitarA, $counter[1] = guitarA, $counter[3] = guitarA, $counter[4] = guitarBhowever, i want it to print to screen asguitarA = qty 3guitarB = qty 1etc.my question is:do i want to handle the "sum" at MySQL (i.e. is there a MySQL built-in-syntax which will do such a thing? [MySQL v.5.0 - PHP 5.current]. i'm far from being well versed in the art of SQL, so please don't take for granted that i might know even the simplest of functions [i can do date INTERVALS and simple joins like above, and that's about it!]), or would i be best to try to create the "sum" on the PHP side? seems like a MySQL thing to me but it's just a hunch.thanks!!!PS. then of course i'll need to play around w/ the SQL to report an "out-of-stock" item. hmm... i think i can tackle that one, but any SQL insight offered for that one will be appreciated as well!thank you!!
  9. i wonder if you happen to know of any general "web site spell check" utilities? i picture it to be a web-based thing (like the w3's validator, or http://validator.aborla.net/ ) i suppose a software utility would be okay-- my only prob w/ that is that i don't want to have to use a Windows-proprietary software when i need it, or that i can only use on Linux when i need it-- however, some is always better than none-- so... whaddaya got?i am fortunate to have a couple IDE's on both Win and Lin which have the Aspell, or some SpellCheck built into the code-view... but there's something about a Firefox "browse-n-view" error check mode which seems to make my vision of the web-based utility seem like the thing-to-do. maybe there's an FF XPI, or Opera perhaps? some kind of browser extension you know of?ideas?thanks!
  10. EDIT: NEVERMIND... i figured it out... it required htmlentities()...i was going to delete this, but i'll leave it for any other unsuspecting DW users. (i.e. sorry 'bout your luck... and mine)please have a look at this output view in haste, admittedly, i used DreamWeaver to make this database admininstrative update thing-- so, while building my app i could just manipulate all of my db data-- so it's not even a "real" page necessarily-- however, i had planned to use it to mess w/ building my app... whatever...the point is-- i can't figure out if i need to do addslashes(), or stripslashes()... it's difficult to understand exactly what's going on depending upon the magic_quotes_gpc directivecan you tell by looking at this what i "probably" need to do w/ the following DW output:(if you can't tell in 5 secs or so-- i'd say don't worry about it-- it's not that big of a deal... but i am curious what anyone might say here... maybe an "ex-DW person", for example. // ## THE MM_ DW THING:function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""){ $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue;}}$editFormAction = $_SERVER['PHP_SELF'];if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);}if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE general_content SET heading_one=%s, para_one=%s, heading_two=%s, para_two=%s, formtitle_one=%s, form_one=%s, listtitle_one=%s, list_one=%s, page=%s WHERE record_id=%s", GetSQLValueString($_POST['heading_one'], "text"), GetSQLValueString($_POST['para_one'], "text"), GetSQLValueString($_POST['heading_two'], "text"), GetSQLValueString($_POST['para_two'], "text"), GetSQLValueString($_POST['formtitle_one'], "text"), GetSQLValueString($_POST['form_one'], "text"), GetSQLValueString($_POST['listtitle_one'], "text"), GetSQLValueString($_POST['list_one'], "text"), GetSQLValueString($_POST['page'], "text"), GetSQLValueString($_POST['record_id'], "int"));// ## THE HTML WHICH MAKES MY EXAMPLE SHOWN ABOVE:<form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Heading_one:</td> <td><input type="text" name="heading_one" value="<?php echo stripslashes($row_GenGeneralContentUpdate['heading_one']); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Para_one:</td> <td><textarea name="para_one" cols="50" rows="5"><?php echo stripslashes($row_GenGeneralContentUpdate['para_one']); ?></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Heading_two:</td> <td><input type="text" name="heading_two" value="<?php echo stripslashes($row_GenGeneralContentUpdate['heading_two']); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Para_two:</td> <td><textarea name="para_two" cols="50" rows="5"><?php echo stripslashes($row_GenGeneralContentUpdate['para_two']); ?></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Formtitle_one:</td> <td><input type="text" name="formtitle_one" value="<?php echo stripslashes($row_GenGeneralContentUpdate['formtitle_one']); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Form_one:</td> <td><textarea name="form_one" cols="50" rows="5"><?php echo stripslashes($row_GenGeneralContentUpdate['form_one']); ?></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Listtitle_one:</td> <td><input type="text" name="listtitle_one" value="<?php echo stripslashes($row_GenGeneralContentUpdate['listtitle_one']); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">List_one:</td> <td><textarea name="list_one" cols="50" rows="5"><?php echo stripslashes($row_GenGeneralContentUpdate['list_one']); ?></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Page:</td> <td><input type="text" name="page" value="<?php echo stripslashes($row_GenGeneralContentUpdate['page']); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Update record"></td> </tr> </table> <input type="hidden" name="MM_update" value="form1"> <input type="hidden" name="record_id" value="<?php echo stripslashes($row_GenGeneralContentUpdate['record_id']); ?>"></form> i realize this is a selfish posting-- and i'm sorry. i really am just hoping someone might glance at that image and give me an idea of which way i need to modify the output strings w/ the addslashes/ stripslahses, etc-- obviously i've tried stuff and it doesn't work. right now-- in that image there were no string functions applied (as seen in the code above)EDIT: wait-- nix what i said above-- i did have stripslashes on! doh!
  11. hi. i've been using a php file for my css like so: ## the HTML:<link rel="stylesheet" href="style.css.php" mediate="screen" />## the PHP:header("content-type: text/css");?>html selectors {properties:values;}## OR the alternative where i'd use@import url('stylesheet.css');## so i get the benefit of CSS syntax highlighting i decided i wanted to try using a _GET value to send info about certain links on a page-- and depending upon which links were selected, i would either "hide" or "un-hide" a list of links-- a little magic trick so i can have all of the content on the page at once, and simply control what is visible by using the "display: none" as is often done w/ the [more...] type thin in a blog for example-- so depending on what the value of the _GET variable is, i would modify a selector from ul#navlist {display:none;}## to this:ul#navlist {display:block;} which i've been doing by way of something like this: if ((isset($_GET['val'])) && ($_GET['val'] == "something")) { print 'ul#navlist {display:block;}';} -- but i can't seem to get it to work right. maybe it would never work that way-- but if i'm on the right track w/ it, i'd appreciate some help in how to format the code. would i use print() to do the "new" CSS output (upon the if else conditional logic), or am i better off using the @import -- and if so, should the @import be part of an if() statement itself? etc., etc., -- there are so many different possibilities-- what is the CORRECT way to do it? i realize it would be probably a TON more easy to do w/ javascript, but i thought this would be a cool thing to try. i'm totally open for suggestions here-- if it's all futile, please let me know what you think.thanks!!
  12. hi. the value of what i'm trying to do here is questionable, however, i believe what i will learn can be applied elsewhere in perhaps many valuable applicationsas part of the pathinfo() array out put, let's say we have the following value: Array( [dirname] => /~domain/htmlfolder/inc [basename] => dochead.inc.php [extension] => php)if you've used the good ol' ../inc/ folder in your own apps, then you know how important it is to have your relative paths staight. i'm in the habit of doing the old-school ColdFusion-esque site layout / app structure (for the HTML part) where i include my header, footer-- and basically every HTML div component-- thereby allowing me to have a very basic skeleton file for the core of the dynamic content of separate pages. oftentimes i find that i want to test a part of what might be a "header" div, or some other part of a page which, without all of the page to put together the relative paths properly, things might either not work, or just get altogether too confusion for this peabrain. my attempted solution so far is to use PHP pathinfo() to determine stuff about my file-- however, this becomes incorrect of course if the function is used when the file [the include() file] is in fact being included into the larger structure. in other words-- what may literally be a path as shown in my example above, might appear to the parser to be coming in at: [dirname] => /~domain/htmlfolder/ (instead of the absoulte, true location of [dirname] => /~domain/htmlfolder/inc so, i ask-- because i'd put money on it that someone else has already come up w/ a bit of code to do this...how might i use, perhaps a combo of str_replace() and pathinfo() [or some other concoction of code] to stick inside of my include files (something like in pathinfo() the example above) which would act as a buffer upon that include file's being loaded into the browser OUTSIDE OF the page where it's supposed to be an include -- so any code might run if i want it to appear as it's in it's proper root-directory-offset.man-- i realize this is getting way too long for this question -- but let me just say, i have a bit that i often use where i define the root-offset e.g. define('OFFSET','inc/') include OFFSET.'somefile.inc.php'; -- just to avoid us covering that ground. maybe it's part of the ultimate solution, but as of yet, i don't have the right arrangeent of numbers and letters to give me an include which will produce no errors. the true, true ultimate goal to be a sort-of error-proofing / error-prevention tactic. maybe this is just poor coding practice? poor software engineering? assuming you can make heads or tails of what i'm talking about here-- i'm all ears for your advice, wisdom, solution, etc. thanks!!
  13. w/out trying it-- does this require hard-coding the thumbs names into the anchor element (re: justsomeguy's code example)? or does it work with the dynamic (or loop generated) image names, as in: header1.jpg// ## would become$newrandimg// ## therefore:<a href="?header="<?php print $newrandimg; ?>"><img src="<?php print $newrandimg; ?>" /></a> not sure if my head's on straight here-- but i'm thinking that a combination of the justomeguy code, and using either my loop or my random image Method to generate the jusstsomegy anchor (as i've shown above) might enable the use of, as you said, the javascrpt event handler. something for me to look at i suppose. remembering of course that part of the goal is to eliminate the need for the programmer to code-in every image anchor-reference, but to let php and glob() do it for himsince i started this thread, i've actually totally recreated this bit, so it's kind of irrelevant to the project by now-- but an interesting technique to try nonetheless-- assuming this is something anyone would ever need / want to do elsewhere. :)my solution (which is unlike what we discussed here) was as follows:since the thumbnails are displayed using an array, i duplicated that array, using the keys in the HTML form select/ option values. the user selects the thumbnail image of his choice based on the thumbnail array key number (which is now printed next to each thumb)
  14. ahh-- i see now. thanks for this idea. i hadn't thought of that at all... i'm taking a totally different approach. have a look.<img class="<?php print $bodyid; ?>" src="<?php print XRO."images/title/thumbs/".$newrandimg; ?>" alt="blah blah Music" longdesc="blah blah Music Store in blah blah" id="randimgpicker"/> kinda schizophrenic, huh? as you might imagine, i was originally just letting the header change randomly as he moved about, looking at different test pages (i.e. $newrandimg...). the dynamic resource is coming from a class which uses glob to scan the image dir. -- probably why i'm so turned off by the hand-coding the thumbs-- because i barely have to do anything to get both the thumbs and their linked images on the page for viewing -- roughly 180 things i didn't have to do... essentially.it was kindof working to demonstrate the different typefaces, but as random things tend to do-- something is always left out, and something is coming up too often. i added the "click here" button to improve the statistics- -- but it merely reloads the page n changes the object data to a new resource -- which itself is yet another random image because that's all the method can do. i broke down and decided i would try to make this "previewing mechanism" more structured-- especially since the "click here" button appears on the thumbnails page too, where it becomes too obvious that the head preview is not following the thumbnail grid (ie. the table of thumbs [really css floats] is using natsort ). so i made a mountain out of a mole-hill because i had to keep trying to make the stupid thing "perfect". by now it's just got me in grrrrr mode. the worst part is-- dude will probably not even spend more than 30 seconds on it. haha!sorry for the mile-long explanation, but it wasn't going to make sense otherwise.
  15. why do i not get this? (oh, i'm slow!). if you have a sec... (unless i try, catch on, and delete this first), would you please embellish a bit here. i'm having a real brain block on this. burned out i guess [on this project i mean] even at over 80, and possibly counting? yeah. i'm nuts. but that's another issue. so-- there are a lot of items here. furthermore-- i'm always thinking in terms of "reusable code"-- gets me into trouble sometimes and bogs me down, but in the end, i have something that might be useful elsewhere. e.g. classes that only serve a purpose of iterating to test arrays, etc-- removed later. -- that's kind of teh idea i have w/ this thing. i can store it away, and next time say to someone else "hey, check out these examples-- choose what you like"it's also completely worthless material in the grande scheme of the site.... but i guess you understand that. the value i seek then really is trying to learn a way to do this.... if that makes any sense. i hope that's not annoying, but it's the only way i ever progress at stuffwhat about using a _SESSION?i'm also linked up to MySQL... maybe i'll just try to do something there. and finally-- after testing some stuff whcih i had working-- where images were different each time i looked-- i got this idea of "it would be cool if each visitor saw something different each time he or she... came to the site..". like a different color head. i did something like that w/ GET and css-- maybe that's what you meant above... but that won't allow the "click for a new image"... or-- wait, maybe i just need to do an array w/ GET -- and the images can flip through each iteration via the key which GET would increment...! is that what you meant?
  16. to make it simple, what i want to do is offer the user a way to "click for a new image"the actual project is as follows: i'm building a site for a friend but i want him to be able to pick out his favourite font typeface for the text i will use in the "header image". i've already created several sample images for him. i have a nice little program i made for throwing the thumbails up there in a dynamic grid (vs a static table), where each thumb is clickable to the full-size head image, but there's something about actually looking at the header in the place where it might finally reside which makes the viewing not only more effective, but also a little less boring (in my opinion, at least).what i was thinking it would be is like this:click here to flip through the head images. simple. straightforward.i tried using a flat file to record the image key, as the thumbs / image grid is displayed using a function which essentially loops through a glob() array... but i gave up on it because i couldn't get it to work. i don't know if i'm doing something wrong w/ the different fopen() based techniques, or if it simply isn't going to work that way (no matter what i tried [in my inexperience with those methods] i could not get the key to increment, nor could i get it to change at all for that matter when using any of the numerous fwrite() tactics i tried.thaks for reading. i look forward to reading any ideas you might have for this. since you never know who's going to have javascript going, i want to stay away from the client-side scripting methods-- especially since this guy is not savvy enough to know how to manipulate the javascript settings of his browser.(sorry so lengthy. it's early. the coffee is STRONG! holy cow!)
  17. hi. although my production db will most likely not have the gaps in primary key autoincrement id which have resulted from my test db here on localhost, due to deleted, duplicate entries, i nevertheless wish to compensate for this situation. it doesn't seem that difficult-- only i have never tried before, and the complexity is a getting a little beyond me... (forgive me if i don't have the jargon correct. i'm only just learning about classes n objects, etc)i've come to ask: is there a better way to gather this data for a sensible, manageble, selectable (via dropdown, perhaps) output later? if so-- how would you approach it?one iteration of the selectAll() method in my data object reveals (content irrelevant, please).. : so, i know i've got 10 rows-- 10 "Events" i want to make available for viewing by selection, but none of which have any consistent number through which a simple $i++ technique will be sufficient for running up the keys, pulling the row data at each instance. so, i've decided that to create multidimentional array such that it's keys 1 - 10 would each represent an iteration (i.e. one row ) of the data object selectAll() function-- but that's where i get a little foggy because it's not familiar territory at all for my experience level... thanks for having a look!: (ps. i realize i could stand to improve this naming convention)require_once '../class/maindata.class.php';$selectall = new mainData();$select = $selectall->selectAll('event');?><pre><?php$x = 0;$myarray = array('$x','array('master_id','editing','calendar','event','room','detail')');while($x <= $selectall->numrows) { print_r($myarray[$x][$select]); $x++;}?></pre> i actually made an edit here which i haven't yet tried, but i'm guessing it's still wrong. thanks for reading. i really appreaciate any advice you might lend, specific or general
  18. i haven't "tried it" yet, but i think i see where at least one of the problems is coming from...instead of using $this->calarray , i've used just $calarray, which in my inexperience, i believe, pretty much negates the whole point of the "object"... so... i gotta fix that for starters...
  19. g'day, mate!please take a look at this code to see if you can determine what might be causing this: near the bottom, you'll see the calarray property i'm trying to get out of there via (declaring?) putting it at the top (sorry-- i'ven't got the jargon just yet...). it will print just fine from inside of the function, and everything else is working right-- but when i try to call the data from an object context, it's just not there. at first i thougth i was doing the ol' trying to print an array from the mysql Resource ID... but that wasn't it either (i don't think). have a look: <?php class viewRecord { var $rows; var $calarray; var $calarrayraw; function queryData($table, $mastid) { global $table; global $mastid; global $calarray; // just trying stuff here w/ this global.. require_once 'db_connect.class.php'; /** i also could NOT get the values to come through when including * this database link definition * so i've just stuck the 'real data' here, as you can see*/ $dblink = mysql_connect("localhost", "blah", "blahblah"); mysql_select_db("blahbleeblah", $dblink); // BASIC QUERY HERE $queryup = "SELECT * FROM $table WHERE $table.master_id=$mastid;"; // DO THE BASIC QUERY --THE VAR from which to FETCHARRAY $queresult = mysql_query($queryup) or die(mysql_error()); $rawarry = mysql_fetch_array($queresult, MYSQL_NUM);/** VERIFY THERE IS DATA */ $rows = mysql_num_rows($queresult); // GET THE SPECIFIC 'HUMAN DATE' AND THAT IS ALL WE DO HERE $calendardata = "SELECT DATE_FORMAT(calendar, '%M-%d-%Y') AS fd FROM $table WHERE $table.master_id=$mastid;"; // DO HUMAN DATE QUERY $querycal = mysql_query($calendardata) or die(mysql_error()); /* this little chunk here is the culpret -- and has taken many forms* this just happens to be one which might make more sense to you... maybe;)*/ $calarrayraw = mysql_fetch_array($querycal, MYSQL_ASSOC); print_r($calarrayraw); $calarray = $calarrayraw['fd'];/* see whats going on? trying to grab that formatted date stuff. * the print_r's output is: * Array ( [fd] => November-22-2006 )*/ return $rawarry;}} ?> i appreciate any advice you have-- on any of it-- technique, solve this puzzle, tell me i need a haircut... whatever. also, that db_link.inc.php thing up there-- all i kept getting was "apache@localhost ... password NO" -- as if it's just defaulting to the Linux user (this is a Fedora system)... i dunno... weird. although, i've probably never tried that particular bit (a db link include).the main problem is the DATE DATA of course. the queryData() function itself (sans 'human date') works beautifully (i think!), so i'm glad of that.thank you!!!
  20. by george, i believe DeathRay2K has got it!! rock n roll man! it doesn't get much easier... but, do we suffer any potential SERVER inconsistencies, or PHP version (4 and newer)? both basename() and pathinfo() are great stuff to know.... how have i gone about missing these gadgets? too much fuss over the same old same old, i suppose... after all-- it's most of what you see in a lot of code which ends up in forums like this-- maybe people stick w/ talking about the basic food groups for fear of having to actually think, vs regurgitating. i must say, i'm impressed w/ the w3schools forum-- i've used the site for years for html css etc, but never thought of it really as a php resource. i'm definitely going to come back here again. y'all seem nice too. (sorry don't mean to sound like a sap-- but it's truly not often that one finds a decent place to talk shop. believe me, i've done one-off's in several forums which didn't get a quarter of the activity that i saw here. it's important to have such a place-- whether it's facilitated by so-called guru's or not-- just the sense of not being 'alone' in one's struggle... blah, blah-- i don't always talk this much-- just trying to say thanks and i'm glad i joined. peace-out, yo!
  21. Gentlemen and Ladies,I extend profuse thanks to all of the generous replies to my post-- it is unfortunate that I must concomitantly express my apologies for my own delayed response to you. Due to an ISP "buy out", a proper provisioning of my router was finally competed today-- resulting in nearly four days of down-time.it will take me some time to read through what all is here, and see what i come up with. i know this particular project moved forward (while i was offline) to a completed state w/out the function i was trying to implement here (whatever that was-- ha!... naw, i'm pretty sure i recall what i wanted...). hopefully, i'll be able to go back in there and plug-in some code and get it working as i desired, if i feel it's still necessary.again-- thank you all.EDIT:(because i see some where asking...)basically, it was like this:use of _SERVER["SCRIPT_FILENAME"] yeilds (on my Linux, Fedora system running Apache 2.2):/home/username/public_html/phpinfo.php (as the output is indeed coming from the good ol' phpinfo script which we all know and love)other similar "built-in" variables provide similar info-- but NONE will give me simply "phpinfo.php", or "some-other-file.php", or "whatever.php" -- because they will all have /some/kind/of/dir/info/before-my-file.php (you see, working sometimes in ColdFusion will spoil the mind.... into thinking everything is always handed over so easily. nyuk, nyuk... blech!)the idea is to get rid of those "leading" characters, so -- as i see Jhecht has remarked, yes-- i do want that-- at least. i believe i also wanted to remove the right side, so i was left w/ instead of file.php , simply: fileobviously, the dot-php part will be easy if i can get the left side to come out right each time. i saw a regex bit up there-- it was my figuring that a proper regex would be precisely the thing...i'ven't tried it yet...EDIT: (wow-- this is an unusal board behaviour! session cookies stuff i guess-- keeps me in the same post? a first i've seen! )so, it looks like jesh is on top of his game here...pathinfo() seems to do what i want-- however, i know last i checked-- my hosting provider hadn't made the switch to v.5 yet... so, easy come, easy go...:)grrrr.... now i don't like this window-- i just hit the wrong button of the 50 available choices below--- and lost a lot of research supported text. yuck.point was that-- cool-- PATHINFO_FILENAME is cool
  22. hi. i'm looking for something with which i can retrieve the name of my current document and essentially echo it out (or enter it into another string, for further manipulation).this might sound crazy, or just plain stupid-- but what i'm trying to do is use _SERVER['PHP_SELF'] and then to use str_replace() to cut off not only the .php which is part of the name of the file (because i want instead of document_name.php to be simply document_name )of course, depending upon which server your php parser is running, you mght get a different output-- so i need for it to be as versatile as possible. for now, i'll just talk about the apache server on my dev machine._SERVER['php_self'] will actually return /username/webroot/document_name.php -- so (on Linux), i get the ENTIRE path to the doc. (and _SERVER['DOCUMENT_ROOT'] goes all the way back to /var/www/html -- the very root of the Apache server-- not much help here really), and then we have a couple other similar output... but in any case, i'm going to need to strip the information all the way on the "left side" until i hit that final "forward slash".so, i'm thinking that maybe some combination of string functions, and maybe even a regex bit could definitely give the result of the document name, sans .php and sans the leading directory info. (in theory assuming there's no non-apache sever complications of course)is this something that anyone out there might have done before? do you have any suggestions on what i might need to do? i think if i could use 'PHP_SELF' , i could do it if only i can get rid of that info to the left-- and that's where i'm lost for knowledge of advanced string function scripting.i look forward to your reply. thanks!
×
×
  • Create New...