Jump to content

DarkendSoul

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Everything posted by DarkendSoul

  1. Oops, I don't think you need nodeValues for simplexml :x
  2. Try this out. >.< Kept thinking about it in bed. $xml = SimpleXMLElement($xmlfile, null, true); echo "Data: " . $xml->xpath("tss_loan_response/data[@name=\"site_type\"]")->nodeValue . "<br />\n"; echo "CData: " . $xml->tss_loan_response->content->section->verbiage->nodeValue;
  3. Or make it include the possibility for tabs and spaces \t|\s (with word boundaries). '~^\b\t*|\s*\becho\s*([\'"])(.*?)\1;~sm' But then again if you have tabs and spaces it would be \t*\s* (no need for boundaries).
  4. I'd write you out something but I'm really tired right now and I'm going to bed. But here's a tutorial that should help you a lot. http://www.phpfreaks.com/tutorial/handling-xml-data You'll probably have to use $tss_loan_response->content->section->verbiage for the cdata.
  5. I think this is what you want. <?php $doc = new DOMDocument; $doc->Load("http://www.expekt.com/exportServlet?category=SOC%25"); $xpath = new DOMXPath($doc); $entries = $xpath->query("//game"); $game_info = array(); foreach ($entries as $entry) { $game_info[] = array( "id" => $entry->attributes->getNamedItem("id")->textContent, "date" => $entry->attributes->getNamedItem("date")->textContent, "time" => $entry->attributes->getNamedItem("time")->textContent // Keep going! ); } header("Content-Type: text/plain;"); print_r($game_info); ?>
  6. $selectBox = "<select id='querytype' name = 'querytype' onchange='loadWheres();'><option>Select Query Type</option>"; $selectBox .= "<option value=number"; if ($querytype == "number") { $selectBox .= " selected=\"selected\""; } $selectBox .= "?>Number</option>"; $selectBox .= "</select>";
  7. AddAttachment is part of the PHPMailer Class, you need to include the PHPMailer class in order to use the function. You have plenty of resources in front of you and code to use them... I don't know what else to give you.
  8. http://ca.php.net/manual/en/function.mysql-insert-id.php
  9. Kind of getting off topic and all, but what's the difference between ~, /, % and a couple other things like that for surrounding the search? Can't seem to find that stuff on regularexpressions.info
  10. Is there a problem with just inserting again after? o.o; if ( isset($_POST['submit']) ) { require_once('load_data.php'); $connect = mysql_connect($db_host, $db_user, $db_pwd); mysql_select_db($database); $title = mysql_real_escape_string($_POST['title']); $post = mysql_real_escape_string($_POST['post']); $category = mysql_real_escape_string($_POST['category']); $tags = mysql_real_escape_string($_POST['tags']); $ip = $_SERVER['REMOTE_ADDR']; $insert = mysql_query("INSERT INTO $table (title, post, category, ip_address) VALUES ('$title', '$post', '$category', '$ip')") or die(mysql_error()); $insert_more = mysql_query("INSERT INTO blog_tags ...") or die(mysql_error()); } header('Location: ../'); exit();[/php
  11. thebadbad: I'm curious... could that problem be solves some how with something like... (([\'"])(.*?)\1.*)+
  12. foreach($_POST['Activity'] as $row=>$Act) { $Activity=($Act); $Position=($_POST['Position'][$row]); $StartDate=($_POST['StartDate'][$row]); $EndDate=($_POST['EndDate'][$row]); if (!empty($Act)) { $involv = "INSERT INTO Involvement (Activity, Position, StartDate, EndDate) VALUES ('$Activity','$Position','$StartDate','$EndDate')"; } I believe thats what you want... also before posting any data to a mysql database you should use mysql_real_escape_string() -> http://ca.php.net/manual/en/function.mysql-real-escape-string.php
  13. No that means that php is enabled on his server but MySQL is not. If you have access to php.ini uncomment the line that says extension=php_mysql.dll On windows. I'm not sure what the exact name is on linux based systems... but basically search through the file for "mysql" and you should find it under the extension section of the ini.
  14. Nuu GingerRoot stole one from me! >:
  15. It looks like your using some sort of non-standard quotes... <?php $c = 50000; $m = (int)((sqrt($c))+1); $p = array_fill(2, $c-1, 1); $i = 2; while ($i<$m) { $j=$i*2; while($j<$c+1) { $p[$j] = 0; $j += $i; } $i++; } echo implode(' ',array_keys($p, 1)); ?> Are you using M$ Word or OpenOffice as a text editor? They tend to make your printed documents prettier by replacing quotes with special ones. For coding I would suggest using something like Notepad++ -> http://notepad-plus.sourceforge.net/uk/site.htm
  16. Hmm my preg_replace is a skills are a little iffy. <?php echo preg_replace_callback("/<(pre)>(.*?)<\/\\1>/ism", create_function("$matches", "return htmlspecialchars($matches[2]);", $input); ?> I'm not sure if you have to backslash < and > or not in regular expressions. so you might have to come back
  17. This may work for you... <?php ob_start(); include($fichier); $output = stripslashes(ob_get_contents()); ob_end_clean(); echo $output; ?>
  18. Not to sure if this'll work, its a shot in the dark. [php <?php function get_tag_data() { require 'cloud_data.php'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); $result = mysql_query("SELECT tag, count(id) AS tag_count FROM $table GROUP BY tag ORDER BY tag"); while($row = mysql_fetch_array($result)) { $arr[$row['tag']] = $row['tag_count']; } return $arr; } ?> [/code] Also removed your redundant sorting.
  19. If on linux generally it's "\n" for a new line. For windows programs it tends to be "\r\n". If you're trying to get line breaks in HTML you need to make them <br /> (XHTML Strict) or <br> (Other). If you want to make it so in a browser "\n" is a line break you send headers with PHP before you display the content. <?php header('Content-Type: text/plain'); echo get_file_contents(dirname(__FILE__) . "./menu/menu.txt"); ?>
  20. http://www.smarty.net/manual/en/api.clear.cache.php or $smarty = new Smarty; $smarty->caching = 0;
  21. Clean your variables before you put them through a mysql query! http://ca.php.net/mysql_real_escape_string
  22. <?php // gather attributes and sub-attributes $get_attributes = "select * from scout_attributes where identity = 'Sailor Moon'"; $get_attributes_res = mysql_query($get_attributes, $conn) or die(mysql_error()); $display_block .= " <td valign=top> <table cellspacing=3 cellpadding=3 border=1> <th colspan=3>Character Attributes And Sub-Attributes</th> <tr> <td><b>Attribute/Sub-Attribute</b></td> <td><b>Level</td> <td><b>Points</b></td> </tr>"; while ($attributes_info = mysql_fetch_array($get_attributes_res)) { $attributes_id = $attributes_info['id']; $attribute_identity = $attributes_info['identity']; $attribute_id = $attributes_info['attribute_id']; $attribute_level = $attributes_info['level_id']; $display_block .= " <tr> <td>$attribute</td> <td>$attribute_level</td> <td> </td> </tr>"; $more_attrs = mysql_query("SELECT * FROM attributes WHERE id = '{$attribute_id}'"); while ($attr_info = mysql_fetch_array($more_attrs)) { $display_block .= " <tr> <td> </td> <td> </td> <td>{$attr_info["attribute"]}</td> </tr>"; } } ?> No idea how you want it displayed but that might work
  23. Personally I think that mail can be such a finicky thing you should let an API handle it. Personally I use PhpMailer: http://phpmailer.worxware.com/index.php?pg=phpmailer For attachments its quiet simple. <?php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->AddAddress("whoever@whatever.com", "John Doe"); $mail->From = "from@example.com"; $mail->AddAddress("myfriend@example.net"); $mail->Subject = "First PHPMailer Message"; $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer."; $mail->AddAttachment("images/phpmailer.gif"); if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } ?>
  24. Actually a quick search on the documentation says that it should be ->Execute with a capital E. http://phplens.com/lens/adodb/docs-adodb.htm#ex2
×
×
  • 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.