Jump to content

jdoe

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jdoe's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm working on a script to adapt the results from an existing script, which are arrays of text strings, into XML. After having some frustrating trouble with Active-Link's XML library, I've taken a break and am working with straight PHP using DOM. I've got up to [code] $dom = new DomDocument('1.0', 'utf-8'); $dom->formatOutput = true;                  $item = $dom->createElement("item"); $title = $dom->createElement("title"); $titletext = $dom->createTextNode($array['title']); $title->appendChild($titletext); $item->appendChild($title); $dom->appendChild($item); $dom->save("test.xml"); [/code] With the array in the sixth line above, and the whole thing in a foreach. My intent is for the foreach to apply this to each value in the array in turn. When I run the script, however, I get the error [code] Fatal error: Cannot use object of type DOMElement as array in test.php on line 6[/code] I at first thought explode might work, but the array doesn't appear to have a delimiter (it does operate normally with "echo," so I feel it's well formed, however strangely), that is, when one calls "echo $array;" or "print_r($array);", the results are valuevaluevalue, though "echo '$array<br />';", as I'd been using it before and it's meant to be used, returns the values line broken. What's the correct way to solve this? I know this is a strange way to present the problem, but I'm hoping what I'm doing wrong is simple enough that someone'll understand without my having to try and replicate it in example code. Is there some function of DOM I haven't yet found that'll accept and pass the values of an array in turn like this? Any help's very much appreciated!
  2. Having just a little trouble with SQLite. I'm running 5.1.3 CGI, with the sqlite, pdo, and (unnecessarily) the pdo_sqlite extensions enabled, on Apache 2.0.55 under XP Pro. I'm trying to, at the head of my script, have SQLite create a table as long as one of the same name doesn't already exist. I read the correct syntax is "CREATE TABLE IF NOT EXISTS," but when I try this, as in this example code: [code]<?php $db = new SQLiteDatabase("test.db"); $db->query("CREATE TABLE IF NOT EXISTS foo(id INTEGER PRIMARY KEY, name CHAR(255)"); ?>[/code] I get the following error: [code]Warning: SQLiteDatabase::query() [function.SQLiteDatabase-query]: near "NOT": syntax error in test.php on line 5[/code] What's causing this; what am I doing wrong? I know it's gotta be something simple, but it's driving me nuts! After a few tests, I'm excited to work with this terrific database system, absolutely perfect for my application, but am stuck due to this! Any help's much obliged!
  3. Sure! The info's dynamically generated, parsed from an array into a static page. I made a quick, totally noobish mockup to illustrate what I mean: An [a href=\"http://jdoe.awardspace.us/example_list.php\" target=\"_blank\"]example list[/a], which shows what the list looks like, an [a href=\"http://jdoe.awardspace.us/example_template.php\" target=\"_blank\"]example template[/a], which represents the template the second page'll be generated from, and an [a href=\"http://jdoe.awardspace.us/example_result.php\" target=\"_blank\"]example result[/a], which is what I'd like the link from the list to achieve; the first link in the example list illustrates what I'd like the link to achieve, a clean pass to a dynamic result page. The whole concern is with the method of the pass from the list page (thru the template), to the result page. It'd be best if the whole thing could be achieved without cookies or javascript (which the visitor may have disabled in their browser), using some header method (??), but any method that'll work will be a step in the right direction! Thanks for the help and thought so far!
  4. Here's my dilemma/prospect: Say we've got a dynamically generated static (cached) HTML page comprising a list of blocks of information (text). I'd like to add to the bottom of each of these blocks a link which'll lead to a second page, created on the fly, dynamically, using a different template than the list-page's, which will display the exact same information in the block which led the visitor here. This is the idea, but I haven't the foggiest where to start looking for info/tutorials on such a concept. I've been searching for info on PHP and "POST" and "GET," but the words are so common that searches bring up irrelevant content (heh); as well, from the trickles of info I have found, it seems these methods're pretty much form-field exclusive and won't be of help (?). I'm guessing it could be done with cookies somehow as well, but if at all possible, I'd like to keep the whole pass invisible -- done in a manner that doesn't touch the visitor's computer at all. I've thought, of course, that it may be more efficient (or would it?) to generate the individual pages, and have the list excerpt the blocks of info from them, not unlike blog systems' excerpt functions ("Read more..."), but, as evidenced by the fact that I'm trying to modify an existing script rather than build one from scratch, this'd require more code skill that I've got at the moment. The structure I've devised as example in mind only is marking/wrapping each block with some type of special tag, which is present or related to a special tag in the link, which'll pass the information (formatting and all) contained in the tags thru to the next page. Am I very far off? How would something like this be done? Is it even possible? Am I getting in over my head? Any help, so much as a point in the right direction, would be much, [b][i]MUCH[/i][/b] appreciated!
  5. God! I had the whole thing backward; it [b][i]is[/i][/b] just plain ol' strtotime()! [i]Idiot![/i] Thanks [b][i]very[/i][/b] much, I've got it now!
  6. While I've easily found a number of manners to convert a timestamp to a formatted date, I'm having the hardest time trying to find a way to convert a formatted date into a timestamp! I know there's got to be a way to "timetostr" as it were, converting a, for example, date(d F Y H:i:s O) formatted date into a MySQL-style timestamp, but I've driven myself to headache and still haven't found it. Any help, a function that'll accomplish this, would be much, [b][i]much[/i][/b] obliged!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.