Jump to content

schilly

Members
  • Posts

    870
  • Joined

  • Last visited

    Never

Everything posted by schilly

  1. just about to say the same thing. <?php $admindetails = mysql_query($queryadmin, $conn) or die("MYSQL ERROR: " . mysql_errno() . " - " . mysql_error()); ?>
  2. If I have a table that logs users with their browser info, what's the easiest command to be able to sort this info based on operating system? Can you use LIKE in a GROUP BY command? ex. SELECT count(id) as hits, operating_system FROM log GROUP BY operating_system LIKE "Windows" Would I have to use multiple queries for each OS (Mac, Windows, Mobile, etc) or can this by done in one query? Thanks.
  3. Awesome thanks. Make sense for the ../ and ./ now.
  4. Ok weird situation here. Here is my file structure: admin -->index.php -->modules/ -->mymodule/ -->index.php -->includes/ -->views/ So everyone is loaded off the admin index.php page and it includes different modules depending on the variables provided. So here's the problem. I'm trying to include a file in includes from a file in views and include("../includes/include.php"); wont work. If I include from the mymodule index.php (includes/includes.php) it works but the include file is all html so I didn't want to have to wrap it in a variable to use it in the views/ script. So I ended up doing some debug and found the executing directory to actually be the admin directory which makes sense because that's where the original request is coming from. Switch my include to (modules/mymodule/includes/includes.php) and it works. Now here's my question. Why would includes/includes.php work in the mymodule index but the ../includes/includes.php not work in the views/ page? Is there something about the file system that breaks when you try to go backwards in a directory? Hopefully this I made this clear. Thanks.
  5. I'm just wondering if a session id is unique for only the period it is in use or if it's unique forever. In the long run will PHP eventually assign a session id that was used months/years ago? I'm not exactly sure what kind of hash it uses to come to the session id. how long is sessionid? 26 chars? so 26^36 possible values?
  6. i'm parsing emails for storage into mysql and i'm having problems with iso-8859-1 encoded emails which have characters like =20 =2C =A0 etc. What the best option for converting these characters? Is it best to do it at the php or mysql level? thanks.
  7. I have a support system that processes email from clients and then stores them in db. I've run into a couple problems with replies from hotmail and yahoo with weird characters like =A0 =20 =2C. These are iso-8859-1 encoded so I'm assuming it has something to do with that. Any ASCII emails are fine. What are my best options to filtering these? Should I filter it at a php level or in the db? I currently don't have a character set applied to the db field. Any help is greatly appreciated. Thanks.
  8. didn't know xml tags need to be nested. fixed.
  9. bah think i figured it out. didn't know you had to have all tags nested.
  10. ok FF says: XML Parsing Error: junk after document element Line Number 7, Column 1: <login> ^
  11. hmmm safari gives me: error on line 7 at column 1: Extra content at the end of the document
  12. I'm having problems outputing this xml to an ajax query. The ajax query is fine(returns 200 OK) but goes into the error callback for some reason. I've narrowed it down to the xml code but can't seem to figure it out. If I comment out all the xml lines after $title->appendChild($dom->createTextNode('Great American Novel')); it works. But if I add anything after that, it breaks. Even my browser says it's bad xml when I load it in the browser and not through ajax. Any suggestions?? <?php header ("content-type: text/xml"); ini_set ("display_errors", "1"); error_reporting(E_ALL); //make sure it was posted $dom = new DomDocument('1.0','utf-8'); //add root - <books> $books = $dom->appendChild($dom->createElement('books')); //add <book> element to <books> $book = $books->appendChild($dom->createElement('book')); //add <title> element to <book> $title = $book->appendChild($dom->createElement('title')); //add <title> text node element to <title> $title->appendChild($dom->createTextNode('Great American Novel')); //login $login = $dom->appendChild($dom->createElement('login')); $loginerror = $login->appendChild($dom->createElement('loginerror')); $loginerror->appendChild($dom->createTextNode('ts_email')); $loginerror = $login->appendChild($dom->createElement('loginerror')); $loginerror->appendChild($dom->createTextNode('ts_password')); //success $success = $dom->appendChild($dom->createElement('success')); $success->appendChild($dom->createTextNode('success')); //errors $errors = $dom->appendChild($dom->createElement('errors')); $error = $errors->appendChild($dom->createElement('Error')); $error->appendChild($dom->createTextNode('ts_name')); $error = $errors->appendChild($dom->createElement('Error')); $error->appendChild($dom->createTextNode('ts_email')); $error = $errors->appendChild($dom->createElement('Error')); $error->appendChild($dom->createTextNode('ts_content')); //generate xml $dom->formatOutput = true; // set the formatOutput attribute of // domDocument to true // save XML as string or file $test1 = $dom->saveXML(); // put string in test1 echo $test1; ?>
  13. <?php header ("content-type: text/xml"); //make sure it was posted $dom = new DomDocument('1.0'); //add root - <books> $books = $dom->appendChild($dom->createElement('books')); //add <book> element to <books> $book = $books->appendChild($dom->createElement('book')); //add <title> element to <book> $title = $book->appendChild($dom->createElement('title')); //add <title> text node element to <title> $title->appendChild($dom->createTextNode('Great American Novel')); //add my own line $login = $dom->appendChild($dom->createElement('login')); //generate xml $dom->formatOutput = true; // set the formatOutput attribute of // domDocument to true // save XML as string or file $test1 = $dom->saveXML(); // put string in test1 //$dom->save('test1.xml'); // save as file echo $test1; ?> ok added my own line and it broke.
  14. <?php header ("content-type: text/xml"); //make sure it was posted $dom = new DomDocument('1.0'); //add root - <books> $books = $dom->appendChild($dom->createElement('books')); //add <book> element to <books> $book = $books->appendChild($dom->createElement('book')); //add <title> element to <book> $title = $book->appendChild($dom->createElement('title')); //add <title> text node element to <title> $title->appendChild($dom->createTextNode('Great American Novel')); //generate xml $dom->formatOutput = true; // set the formatOutput attribute of // domDocument to true // save XML as string or file $test1 = $dom->saveXML(); // put string in test1 //$dom->save('test1.xml'); // save as file echo $test1; ?> ok this default examples give success msg but when I try to add my own xml it breaks.
  15. hmmmm ok. seems to be something in my php file when outputting the xml.
  16. So I've been pounding my head on this for a day now. I haven't had any problems using ajax in jquery up until now though it is the first time I've tried to get an xml response. function addReview(){ $.ajax({ url: "ajax/add_review.php", dataType: "xml", type: "POST", data: $("#review_form").serialize(), success: function(msg){ alert("success"); }, error: function(xhr, ajaxOptions){ alert(xhr.status); alert(xhr.statusText); } }); return false; } So every time I run this it goes into the error callback and gives a 200 OK status message in the alerts. Firebug also says 200 OK code so I don't know why it won't go into the success callback. The xml response from the php files looks good too. Any suggestions?? Thanks.
  17. ok found the answer here. http://stackoverflow.com/questions/149573/check-if-option-is-selected-with-jquery-if-not-select-a-default $("#mySelect option[value=3]").attr('selected', 'selected'); thx.
  18. Is this possible? What is the best way to go about doing this? Would I have to find the current selected option, remove the selected attribute then set the option I want selected? Thanks.
  19. ok got it working. when reloading from the same url, the browser would always pull from cache so even though the image was different, it would just use the cached version. so i found a hack about adding a query string on an image src to force it to reload instead of using the cached version. function reloadPic(thumb,video,aspect,id){ var string = 'thumb='+thumb+'&video='+video+'&aspect='+aspect; var imageID = '#' + id; $.ajax({ type: "GET", url: "newThumb.php", data: string, success: function(msg){ var img_src = $(imageID).attr('src'); var timestamp = new Date().getTime(); $(imageID).attr('src',img_src+'?'+timestamp); } }); }
  20. no it's a little different that just a hover. i am creating thumbnails from a video file and if the thumbnail taken from the video is in an undesirable location then i am clicking a button, using ajax to call the script to generate a new image then i just need the existing image to refresh and show the new image. currently have: function reloadPic(thumb,video,aspect,id){ var string = 'thumb='+thumb+'&video='+video+'&aspect='+aspect; var imageID = '#' + id; $.ajax({ type: "GET", url: "newThumb.php", data: string, success: function(msg){ var img_src = $(imageID).attr('src'); $(imageID).attr('src',img_src); } }); } with the link being: <input type='button' onClick=\"reloadPic('$thumb1','$movie1','$aspect','$tutorial"."1');\" value='Reload Thumb'>
×
×
  • 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.