Jump to content

rune_sm

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rune_sm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey everyone I'm having this annoying error in phpmyadmin. I have installed PHP, Apache and Mysql, and everything works great. I can use the command line MySQL client and communicate with php / mysql. But when I run PhpMyAdmin, i get this error: "Cannot load mysql extension. Please check your PHP configuration. - Documentation" But I have done all the things needed, and MySQL works... What am I missing? Im using php 5.2.5, Apache 2.2.6 and MySQL 5.0
  2. Hey everyone I'm making a php-script that I can use to access any Mysql table i use. That's why I don't know the names of the columns. Sometimes it's a table containing new, sometimes url-links to pictures. The script outputs an xml file to flash, and I usually do something like this: <?php // Database iinformation $db_host="myhost.dk"; $db_user="myuser"; $db_name="mydbname"; $db_password="mypass"; mysql_pconnect($db_host, $db_user, $db_password); mysql_select_db($db_name); // Select data in database $result = mysql_query("select * from news"); // Loop through it while ($row = mysql_fetch_array($result)) { print('<headline>'.$row["headline"].'</headline>'); print('<date>'.$row["date"].'</date>'); print('<text>'.$row["headline"].'</text>'); } ?> But when I don't know how many columns I have in my table or what their names are, I cannot figure it out. What I want to do in my loop is something like this: // Loop through it while ($row = mysql_fetch_array($result)) { print('<'.$row["column1name"].'>'); print($row["column1data"]); print('</'.$row["column1name"].'>'); print('<'.$row["column2name"].'>'); print($row["column2data"]); print('</'.$row["column2name"].'>'); print('<'.$row["column3name"].'>'); print($row["column3data"]); print('</'.$row["column3name"].'>'); .... and so on looping through all my data in the table } How can I do this? - thanks - Rune
  3. Hey everyone I'm making a php-script that I can use to access any Mysql table i use. That's why I don't know the names of the columns. Sometimes it's a table containing new, sometimes url-links to pictures. The script outputs an xml file to flash, and I usually do something like this: <?php // Database iinformation $db_host="myhost.dk"; $db_user="myuser"; $db_name="mydbname"; $db_password="mypass"; mysql_pconnect($db_host, $db_user, $db_password); mysql_select_db($db_name); // Select data in database $result = mysql_query("select * from news"); // Loop through it while ($row = mysql_fetch_array($result)) { print('<headline>'.$row["headline"].'</headline>'); print('<date>'.$row["date"].'</date>'); print('<text>'.$row["headline"].'</text>'); } ?> But when I don't know how many columns I have in my table or what their names are, I cannot figure it out. What I want to do in my loop is something like this: // Loop through it while ($row = mysql_fetch_array($result)) { print('<'.$row["name-of-column1"].'>'); print($row["data-in-column1"]); print('<'.$row["name-of-column1"].'>'); }
  4. You have to use the load_string command if it's not an XML file.... Take a look at the example at the php.net site: http://dk2.php.net/simplexml
  5. Hey everyone I just wanna do this simple thing... I have an XML file, that looks like this: <site> <picturealbums>   <album>My first Album</album>   <album>My Second Album</album> </picturealbums> </site> I just want to make a simple script using dom, where I can delete a selected <album>. I can easily put a new album into the XML-file with this code: $nodes = $dom->documentElement->childNodes; foreach ($nodes as $subNode) { if ($subNode -> nodeName == 'picturealbums') {   $subNode -> appendChild($album); } } But how do I find a desire <album> and delete it? It's a problem for me, because it's a child og another childnode...   - Rune
  6. hey everyone I'm making a file, that can write news text into an xml-file. All my text for my page is in the xml-file, and the structure kind of looks like this: <site> <news> </news> <pictures> </pictures> <biography> </biography> </site> I have a piece of code (using the dom-functions) and I can easily create new tags within the root-tag. The problem is, that I want to put it inside the news-tag, so I can organize it. I've tried looking around in php.net/dom, but can't really fiure it out. Should be easy anyway. Here is my code: $file_name="text.xml"; $dom = new DomDocument(); $dom->load($file_name); $item = $dom->createElement("item"); $overskrift = $dom->createElement("overskrift", "I am a headline"); $tekst = $dom->createElement("tekst", "I am a text"); $linebreak = $dom->createTextNode(chr(10)); $item->appendChild($overskrift); $item->appendChild($tekst); $item->appendChild($linebreak); $dom->documentElement->appendChild($item); $dom->save($file_name); What I want to do is sort of like $dom->documentElement->news->append.... But that doesn't work. Can you help me?   - Rune
  7. Hey everyone All I want it to be able to create an xml file with php... I know php, but can't find any good tutorials on how to use them? I have looked around on the php.net site, but I can't really get it. Any good tutorials?
  8. Hey everyone I'm building a Flash-site that gets all its text from an XML file. Now I'm looking for an open-source project in php, that is made for editing and making XML-tags, instead of coding everything myself. Do you know any good projects???   - Rune
  9. Ok... So if I have  this datetime:    1983-03-01 21:30:15       And the current datetime is:  2006-08-30 23:57:10 How do I compare these 2 dates and see if the first datetime is before or after the current time?
  10. Hey Everyone I want to make some code, that evaluates whether or not a given date and time is before or after the current date and time I have a date and time in my database (what is the best format to store this in?), and then compare it to the current date and time and see if the database date and time has passed the current date and time. Something like this: [code] if(currDate =< DBdate) {   if(currtime =< DBtime)   {       print('the ime hasn't come yet');   } } else {     print('the time has passed'); } [/code] How do I do this. I have read the time FAQ but can't really figure it out...??   - thanx
×
×
  • 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.