Jump to content

k.soule

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

About k.soule

  • Birthday 04/02/1985

Contact Methods

  • AIM
    TheSixthApostlle
  • MSN
    all_maya@hotmail.com
  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Illinois

k.soule's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks, I know the difference between HTML and XML...terrible advice (and quite insulting). It is not always the same, if you view source on this particular page I'm looking at, it shows raw XML; however, if you "Save page as", it will save it as the HTML document you actually see in your browser window. The actual solution to those that might wander into this topic looking for help is to mimic a browser. Grab the contents via curl but be sure to add this line in, or something similar, in: curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); This will, in the end, return the XML and not the HTML. Nifty![/code]
  2. I've spent the better part of the night searching all over the internet for a solution to a problem I'm having with XML. The problem is, I am trying to get just the raw XML file from a server (which is shown when you view source) before it turns it into HTML via the XSL stylesheet. Does anybody have any tips or pointers on how to achieve this? file_get_contents(), fopen(), and curl are all returning the server parsed HTML file; however, Firefox and IE7 show me the XML source when I view source...very strange and frustrating. Hoping you guys can help!
  3. trim is a function to remove whitespace from the beginning and/or ends of a string, it seems like you just want to have a string with all that info in it and be able to pull any of the data out of it at a given time, why not use an array? Unless I'm misunderstanding you. If it must be a string though, you can probably use preg_replace to return only the string you want.
  4. You may want to fiddle with the quote_style argument on htmlentities(), you may be able to avoid passing it through stripslashes().
  5. Try addslashes() when echoing the string, just a thought. Edit: Forgive me, addslashes() should be applied [i]before[/i] putting the information in the database. In your query, try using ' ' instead of " ", it sounds like a problem of exiting the string prematurely.
  6. [code]IF ( (ARGUMENT is TRUE) && (ARGUMENT2 is TRUE) ) { // evaluate }[/code] && is AND || is OR
  7. $upload = move_uploaded_file($_FILES[u]['picture'][/u]['tmp_name'], "[u]/home/www/htdocs/[b]$id[/b].jpg[/u]"); $_FILES['picture']['tmp_name'] is the temporary name on the server, change picture to the name of the form element that you are uploading with. /home/www/htdocs/$id.jpg is the location, change /home/www/htdocs/ to match your file system structure, $id would be the variable holding the identification of the person and, of course, .jpg is the extension. $upload will be 1, if the upload was successful. [i]EDIT -> Let me clarify the above, ['tmp_name'] should not be changed, it stands for the temporary name that the server is using to store the uploaded file, uploaded files are always moved to a temporary file and then moved to a permanent location. It doesn't pass the filename the user put in, if you wanted that name, it would just be ['name']...but that is useless unless you want to preserve the same file name; the only element of that code that will need changed is ['picture'] and the location and variable of the final location, as underlined above.[/i]
  8. Whoops! Not to even mention it printed out the same thing three times :) The below script works fine - [code]<?php echo "<table><tr><td>"; $cnt = 1; while( $row = mysql_fetch_assoc($list_result) ) {          print "<td>";     print "<img class='image' width='80px' height='150px' src='$row[picture]'             href='./recommendation.php?id=$row[item_id]' alt='Picture'><br>\n";               print "<a href='./recommendation?id=$row[item_id]>$row[Title]</a><br>$row[cost]\n";            if($cnt == '3') {         print "</td></tr><tr><td>";         $cnt = 0;     }     else {         print "</td><td>";     }                $cnt++;     } print "</td></tr></table>"; ?>[/code]
  9. Pass the array with sessions, simplest solution I can think of.
  10. Well, you stretched the page quite terribly...and you didn't even tell us your problem. You need to program that in PHP, that isn't a problem, though..."programming" it in PHP would be putting an echo before it line and making it impossible to read :) So, two things, put the HTML in [ code ] tags! and describe what you intend to do with this page and script (obviously you are sending something via mail, is that your problem?).
  11. I suppose this should even do exactly what you wanted -- [code]<?php // echo "<table><tr>"; while( $row = mysql_fetch_assoc($list_result) ) {         $cnt = 1;     while($cnt <= 3) {                 print "<td>";         print "<img class='image' width='80px' height='150px' src='$row[picture]'                href='./recommendation.php?id=$row[item_id]' alt='Picture'><br>\n";                   print "<a href='./recommendation?id=$row[item_id]>$row[Title]</a><br>$row[cost]\n";                  $cnt++;         }     print "</td></tr>"; } ?>[/code]
  12. [code]<?php echo "<table><tr>"; while( $row = mysql_fetch_assoc($list_result) ) {         $cnt = 1;     while($cnt <= 3) {         print "<td>";         // Your images here         $cnt++;     }     print "</td></tr>"; } ?>[/code] Terrible english discourages people from answering, if you can't take the time to talk intelligently, why should someone take the time to respond?
  13. You can use a loop like so: [code]$query = mysql_query("SELECT website FROM users"); while($row = mysql_fetch_assoc($query)) {     if($row['website']) {         $ret = $ret . $row['website'] . "\n";     } }[/code] When all is said and done, $ret will hold a variable with every website from the user table that had an entry (make the default website field NULL), put it in a file via whatever means you like, I don't think that was intended to be answered along with the above? Of course, the mysql_query() will need changed unless I guessed correctly...
  14. [code]$text = htmlspecialchars("<o:BLAHBLAHBLAH />"); if(ereg('&lt;o:(.*) /&gt;', $text)) {     $text = str_replace("&lt;o:", "", $text);     $text = str_replace("/&gt;", "", $text); }[/code] Maybe, it isn't as elegant as a single line replace, but it does the same thing. Sorry, I thought all you wanted to do was replace what was inside, in which case the solution was simple :o I don't know if you can match on something and replace on another match inside of the match.
  15. Try strtotime("1900-09-10"), I'm on PHP 5, also.
×
×
  • 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.