Jump to content

DVigneault

Members
  • Posts

    33
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

DVigneault's Achievements

Member

Member (2/5)

0

Reputation

  1. I see...so, two companies putting out their own versions of a similar product. I get it. Thanks a bunch!
  2. Hey all-- As I went to install MAMP 2.1.1 on my new machine, I thought I'd check to see if it was available in the app store. There, I found BitNami MAMP Stack 5.4.9, which I've never used before. What's the difference? Are they made by the same developers? Have I been using an out-of-date version, by using MAMP 2? Best, and happy new year! --Davis
  3. Thanks to both of you for your responses! @Christian -- I see that using "function" as the name in my example was a bad idea. The actual function is called buildInputField and is defined in an include. My question was really whether there was a way to check if the user has submitted the POST variable within the function, to prevent needing to wrap the function with isset each time I call it, without getting a notice. Per your code, it seems like performing that check before calling the function is the way to go. Best, and thanks again, –Davis
  4. Hey all– I've got a function that uses data from a variable from a user. Originally it was set up as follows: <?php function($_POST['variable']) { if (isset($_POST['variable']) && preg_match($_POST['variable'], $pattern)) { //Do something } else { //Do something else } ?> However, when I do this before giving any input, I get a notice saying that the variable isn't set. Now I realize that the notice is telling me something that I am accounting for in my function, and that the user won't see the notices when I turn off error reporting. However, the notice still makes me uncomfortable--should I be worrying about it? And, if so, how do I change it? I know that I can check to see if the variable is set before feeding it to the function, but this seems to partially defeat the purpose of having the function (if I need to re-write the same code over and over again each time I call it). Any thoughts or advice? Best, –Davis
  5. No...the stylesheet doesn't load. I get an access-denied-type message. I can't figure out what my stylesheet could be doing that's against its filtering rules.
  6. Thanks for the reply! Here's the site: www.clinicalc.com Here's the stylesheet: www.clinicalc.com/common/style.php Also, I looked up BlueSocket, which is the company that provides the wireless service to the library: http://www.bluesocket.com/solutions/vwlan I hope this helps, but, if not, thanks anyway for trying! Best, –Davis
  7. Hey all– I'm having trouble loading a stylesheet when I'm loading the website through a certain network. The stylesheet is referenced as follows: <base href="http://www.mywebsite.com/"> <link rel="stylesheet" type="text/css" href="common/style.php" /> The stylesheet itself is at mywebsite.com/common/style.php. When I visit the site from home, or from a cafe, or my school, or whatever, it loads find. However, when I visit the site from the public library, via a "filtered" public connection (it's the Boston Public Library, and it's connecting via "BlueSocket," which I'm not familiar with), the stylesheet doesn't load. I don't have this problem when I visit any other websites via the same connection. Any ideas about what might be going on, and how I might fix it? Best, and thanks, –Davis
  8. var_dump() helped alot--I've got it working! The problem, it seems, was that I included the <urlset> parent element in my foreach path. When I got rid of that, everything worked like a charm. :-)
  9. Thanks for the help, ChristianF--I didn't realize that you could append to a variable like that. The output looks like: <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://example.com</loc> <lastmod>2012-07-30</lastmod> <changefreq>monthly</changefreq> <priority>0.5</priority> </url> //More <url></url> elements </urlset> In the code-block I gave in my last post, the error is on the foreach statement: foreach ($sitemapXML->path->to->element as $var) { and it says that I'm supplying an invalid argument. Searching on google says that this could mean that I'm not supplying it with an array (and, infact, I just found the is_array() function, and is_array($sitemapXML) returns false). Thanks again for your help, everyone.
  10. So I've got it outputting XML using ob_start(), ob_get_contents, and ob_end_clean(), as follows: $xml1 = <<<XML <urlset> //and some hard-coded XML XML; ob_start() $con = new mysqli($host, $username, $password, $database); $result = $con->query("SELECT stuff"); mysqli_close($con); $row = mysqli_fetch_array($result); while ($row = mysqli_fetch_array($result)) { echo '<parent>'; echo '<child1>' . $row['something'] . '</child1>' . PHP_EOL; echo '<child2>' . $row['somethingelse'] . '</child2>' . PHP_EOL; echo '</parent>' . PHP_EOL; $xml2 = ob_get_contents() ob_end_clean() $xml3 = '</urlset>'; $sitemap = $xml1 . $xml2 . $xml3; Printing $sitemap with the xml header works, but... $sitemapXML = new SimpleXMLElement($sitemap); foreach ($sitemapXML->path->to->element as $var) { echo $var->whatiwant; } ...gives me an error, saying that I'm supplying an invalid argument. Thanks for bearing with me...
  11. Thanks! So I think understand how to store the hard-coded part of my XML as a string... <?php $xmlstr = <<<XML //Some hard-coded XML XML; ?> ...but what about XML I'm generating from a database? So far I've just been getting it from a database and echoing it like this: $con = new mysqli($host, $username, $password, $database); $result = $con->query("SELECT stuff"); mysqli_close($con); $row = mysqli_fetch_array($result); while ($row = mysqli_fetch_array($result)) { echo '<parent>'; echo '<child1>' . $row['something'] . '</child1>' . PHP_EOL; echo '<child2>' . $row['somethingelse'] . '</child2>' . PHP_EOL; echo '</parent>' . PHP_EOL;
  12. Hey all-- So I've got a php script that generates an xml page, which is working, as follows: <?php header ("Content-Type:text/xml"); echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> //Functions to generate xml I'm then trying to grab some of that data in another php script. In the past, when the xml was hard-coded (file extension .xml), I've used the following: $xml = new SimpleXMLElement(file_get_contents(/path/to/file)); When I try to use this to grab my dynamically-generated xml page above (file extension .php), I get a bunch of SimpleXMLElement::__construct() warnings. Sorry in advance if this is a naive question--I'm sure what I'm doing wrong will be glaringly obvious to the people reading this forum. Best, --Davis
  13. Hey all-- I hope "PHP Applications" is the right place for this question. I've recently installed Sphider (v1.3.5) on my local machine (PHP v5.3.6, Apache v2.2.2.1, via MAMP v2.0.5), and am trying to get it to index my (local) site. However, when I add http://localhost/home/, check "index depth = full", and start indexing, it indexes that single page, but doesn't follow the links on that page. The output looks like this: There was a forum post on the Sphider website about it (here: http://www.sphider.eu/forum/read.php?2,4973,4973) but no one ever came up with an answer. Any ideas? --Davis
  14. Hey all-- Just downloaded Sphider 1.3.5 (I'm running php 5.3.6, MySQL 5.5.9) and have a question about the installation. When I ran the installation script, I got the following error: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(14), elapsed float(2), results int, key query_key(query))' at line 3 Someone on another forum suggested removing the "(14)" from one of the query statements, as follows: #Before mysql_query("create table `".$mysql_table_prefix."query_log` ( query varchar(255), time timestamp(14), elapsed float(2), results int, key query_key(query))"); #After mysql_query("create table `".$mysql_table_prefix."query_log` ( query varchar(255), time timestamp, elapsed float(2), results int, key query_key(query))"); When I make the change, the installation runs perfectly. That said, I'm very new to SQL, and am uncomfortable doing it without understanding why. Is anyone able to explain to me the error, why removing the "(14)" works, and if there are any reasons why I should be going about it another way? Best, ?Davis
×
×
  • 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.