Jump to content

cpd

Members
  • Posts

    883
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by cpd

  1. 147099 = 594088 147099 = 594086 147099 = 594085 147099 = 594082 147099 = 594083 147099 = 594089 Each line is unique in itself. Just because you have 147099 many times it doesn't mean its not unique because they are relationships. That said, we don't know how the data is represented - as trq said - nor do we know what your system and its purpose is. I could understand the purpose if you wanted to select only the ID part but you want both IDs so it doesn't really make sense at the moment.
  2. Don't worry about any of that, I've been training in the art of telepathy.
  3. So you're eliminating a load of relationships? Sounds like somethings going to break...
  4. A very dark, grey font doesn't stand out against a very light, grey background? I've no idea how you came to that conclusion.
  5. You can't come here every time you hit a small error asking what's wrong. You'll never get anywhere mate! Lets abstract the problem so you can learn something. Create a new PHP page and set up a connection to your database. Now take this code and add it to your new PHP file $query_getRecent = "SELECT news.post_id, news.title, news.post_type FROM news WHERE news.post_type = 1 ORDER BY news.updated DESC "; $getRecent = mysql_query($query_getRecent, $check_mag) or die(mysql_error()); And see whats happening by adding after the query code while($row = mysql_fetch_assoc($getRecent) { var_dump($row); } What are the results?
  6. That's your localhost, we cant see that. Are you testing everything at your localhost?
  7. Have you installed all the correct drivers? I assume you're using SQL Server 2008 Express. http://www.microsoft.com/en-gb/download/details.aspx?id=20098
  8. Why have you wrapped a very specific form in a function called "form"? Just write the HTML as you would normally, above that open PHP tags and set the image URL. E.g. <?php // Do some stuff // Set the image $imageURL = ... ?> <html> <head> </head> <body> <form> <img ... /> </form> </body> </html> I assume you're not going to actually set the image URL like that? And yes its probably a path issue. Assuming you've uploaded the image properly, use the URL you would to view the image in a browser.
  9. Assuming $getRecent is the resource you're referring to, yes it should only get a post_type of 1 - WHERE news.post_type = 1. That said, I can't see you using taht resource anywhere other than the two lines after it. Personally, I can't be bothered looking through it again because You've not actually asked specific question or described a specific problem. You've given us a code dump of your entire page; frankly we don't care what DTD you're using among other things included. None of your code has comments making it really hard to understand. You've not provided us with any debugging steps you have carried out yourself. Rewrite your post with details of the specific problem, specific code snippets related to the problem, comments on what the code is doing and anything you have done off your own back to find the problem. I appreciate its your second post here, but how do you expect us to help you with a problem if you can't be bothered to help us identify the problem?
  10. What do you mean dynamically? You're being quite vague. If you want to display a different image each time you'll need to use PHP to choose the image and then echo it out... ... <td><img src="<?=$imageURL;?>" /></td> ...
  11. You upload a file and it does "unrelated stuff to your website" - that doesn't really make sense. You mean you have a form used for uploading files and the files don't affect your website in any way once uploaded? Putting an image online is as simple as moving it, once uploaded, to the public directory or a sub directory in the public directory; the move_uploaded_file function will do this for you. You then just need to submit a URL with the correct path to view it in your browser. E.g. If you upload a file to "/home/myaccount/public_html/images/foo.png" you should access it from "domain.com/images/foo.png".
  12. Please tell me your code isn't actually formatted like that?
  13. Saying you have lots of errors will get you absolutely no-where. In-fact, you may even go backwards it is that unhelpful. Try explaining, in detail, what you've attempted and provide code snippets. Include what debugging steps you've carried out on your own initiative (if any) and then we can hep you from there. Ultimately, you want a PHP File Upload system and making a basic one probably takes less than 50 lines of code.
  14. You don't upload files to the "FTP". The File Transfer Protocol (FTP) is a means of accessing files held on a machine (often a server). All you want to do is upload the files to the host and ensure the files are put into a folder the users FTP account has access to.
  15. You're still not hearing me or thinking logically about this. $report->getAttribute("timestamp") will look for the "timestamp" attribute in each report node: <reports timestamp="[some timestamp]"> ... </reports> You want to get an element that's that's a child node of the "reports" tag and as such should grab it the same way as you would get the reports using $report->getElementByTagName("timestamp"): $reports = $root->getElementByTagName("reports"); foreach($reports as $report) { $timestamp = $report->getElementByTagName("timestamp")->item(0); // Code omitted } This now looks for the timestamp using the XML structure you have. Because I'm feeling nice, I wrote this script in 10 minutes by applying logical thought and reading the documentation. It removes the "reports" that are older than 1 hour: // Load the document $doc = new DOMDocument(); $doc->load('test.xml'); // Get the root node and timestamps $root = $doc->documentElement; $timestamps = $root->getElementsByTagName("timestamp"); // Define a variable for the current time $currentTime = strtotime("-1 hour"); // Define an array to hold the nodes we want to remove $remove = array(); // Cycle through each timestamp and determine if it was set more than 1 hour ago // If so add it to our remove array foreach($timestamps as $ts) { $time = strtotime($ts->textContent); if($time < $currentTime) { $remove[] = $ts->parentNode; } } // Remove all the nodes found foreach($remove as $node) { $root->removeChild($node); } // Save the document $doc->save("test.xml"); You'll notice I did it slightly differently than the way you were trying to do it. I just grabbed the timestamps and looped through them, when one is found that's older than 1 hour, it adds the parent node on to the remove array; the parent node being the "reports" node associated with that timestamp.
  16. Create a login system and call it a "Video Tracking" system. Your boss doesn't know his/her ass from his/her face if what you've described is actually what your boss wants. That said I don't know the project requirement details so perhaps he does know where his/her ass is. What you've said however, leans be towards believing he/she doesn't.
  17. Reviewing that you can just do $root->getElementsByTagName("timestamp")->item(0)->textContent; but in your scenario you need the reports node as well.
  18. http://stackoverflow.com/questions/8932177/301-redirect-adding-query-to-end-of-target-url Have a read of the answer. Post your htaccess contents if you're stuck.
  19. Afraid not. Its actually looking for an attribute called "timstamp" in the "reports" nodes. So what its expecting is <reports timestamp="[some timestamp]"> ... </reports> Like I said before, "timestamp" is an element, not an attribute. No matter which node you try to select it from using the $node->getAttribute($name) method, it'll never get it, EVER, because its not an attribute. If you want the timestamp of the first "reports" node you need: $timestamp = $dom->getElementsByTagName("reports")->item(0)->getElementsByTagName("timestamp")->item(0)->textContent;
  20. Function/methods within PHP replicate variables passed to them via parameters therefore, you are manipulating a replica of the variable not the variable itself. When passing by reference, you are then manipulating the actual value itself even though its defined outside the scope of the method/function. E.g. function plusTwo($var) { $var+= 2; } $a = 1; plusTwo($a); echo $a; // Output is 1 still because $var is a replica of the value passed in. /* ------------- */ function plusTwo(&$var) { $var+= 2; } $a = 1; plusTwo($a); echo $a; // Output is 3 because you passed the variable in by reference and the value was directly manipulated With regards to assignments: $a = 2; $b = 4; $c =& $a; $d = $b; echo $a; // Output is 2 echo $b; // Output is 4 echo $c; // Output is 2 echo $d; // Output is 4 $c+= 1; $d+= 2; echo $a; // Output is 3 because $c directly manipulated the value it references to echo $b; // Output is still 4 echo $c; // Output is 3 echo $d; // Output is 6 because $d is a replica of $b and therefore has a different value
  21. No. Arguably I should have been clearer as to which question I was answering. Thanks for clarifying Jessica.
  22. From what you've provided we can't give a 100% accurate answer, but assuming your form is set up to submit via POST you can access it in your PHP script using the $_POST super global.
  23. Out of interest, why would you want to popup every time the select something. As and end user that would be so flaming annoying its untrue. You're code wont work due to how you're closing the onclick attribute. You need to be careful when echoing javascript. This will work: echo "<a href=\"#\" onclick=\"javascript: alert('".$row['Mobile']."');\">".$row['Name']."</a><br>";
  24. 2 issues: $timestamp = strtotime($domElement->getAttribute('timestamp')); 1) Timestamp is an element in your XML document, not an attribute. 2) Are you sure the date/time format you've stored in the XML is a valid date/time format as per the documentation http://uk1.php.net/manual/en/datetime.formats.php? It doesn't look like any of the valid ones to me, could be wrong though. Best thing to do is echo it out and see if it worked.
  25. You need to explain yourself better. "becuz we input numbers of records returned by a query to pagination counter" this, just makes no sense to me, along with other sentences. The impression I get is: you execute queries and get results but don't know which query will return the largest results? Yet you want to apply pagination to only one div, the one with the most data? Consider re-writing your entire OP in a new post explaining yourself much more clearly and with the relevant code, not a code dump.
×
×
  • 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.