Jump to content

Nico7430

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Nico7430's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. @ Jasonrichardsmith: I have to admit that what I am searching for, is a bit more complicated than my first post in this thread. I work a lot with xml and try to understand how php works with xml. Every time I import attributes and want to do something with them (sort them, select them, etcetera), I get those multidimensional arrays which I don't know how to use... The problem looked very much like the example I gave in my first post here. Indeed, I took that example from the Wrox introduction on php, but I have to say... the first time I saw that example, I wondered already what somebody needed to do when he/she would like to use this array in a way it was not designed for... I can put my whole project here, but... I rather like to put it simple and then try it further on my own. Silkfire: thanks a lot! It works. That was the code I was looking for.
  2. I want to create an array based on data in a multidimensional array. Take, for example: $table[1] = array('husband' => array ('firstname'=> 'Albert', 'lastname' => 'Einstein', 'age' => 129), 'wife' => array ('firstname' => 'Mileva', 'lastname' => 'Einstein', 'age' => 128)); What would be the best approach, when you want to create an array with only the last names or the ages? Are there some things like wildcards in the PHP array universe to skip the first array level? Any suggestion is very appreciated. I tried several strategies, but ended up creating the same mulitdimensional array as above.
  3. Mmm, I have to agree that things did not work as I expected. But the code to use the value of an attribute looks like: $reports = $xml->xpath("/data/Report[@id=3]"); Nice. Thanks.
  4. Ah, I need to change the line: if ($var = "not") { in: if ($var == "not") { Great!
  5. Hi I want to select certain elements of an xml-file by value of attributes. Take for example: <?xml version="1.0" encoding="UTF-8"?> <data> <Report ID="3"> <Date>REVIEW</Date> <AuthorID>3b</AuthorID> </Report> <Report ID="2"> <Date>REVIEW</Date> <AuthorID>2a</AuthorID> </Report> </data> Now I want all the information (elements, data, etc) associated with attributes ID that have the value "3". I tried the following code: <?php $xmlDoc = new SimpleXMLElement('data.xml', null, true); $var = $xmlDoc->Report['ID']; if ($var = "not") { echo "ID = yes"; } else { echo "not"; } ?> However, it always shows "yes", whatever value I add for $var in the if-statement. I have the impression that it produces a boolean value based on the question if there is an ID-attribute at all. But how do I access the value that is inside as a criteria to select with?
  6. I want to use ICA Atom, an archiving program demanding PHP and MySQL. Previously, I got Apache (httpd-2.2.6), PHP (php-5.2.5) and MySQL (mysql-5.1.22) working in my Fedora 10-environment without ICA Atom, but ICA Atom demands PDO connections. At this moment, my configuration command for PHP looks like: "./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring --with-xsl=/usr/local/xsl --with-pdo-mysql" and the installation goes without problems. However, when I try to start up ICA Atom, I get the following error: "Unable to open PDO connection [wrapped: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)]" How can I solve this?
×
×
  • 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.