Jump to content

denno020

Members
  • Posts

    761
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by denno020

  1. Does anything get output when you do the var_dump? I can see from the character count that it's long, so I wouldn't be surprised if the output is truncated, but I would still expected to see a little bit.. Try print_r, or echo of the $data variable. Then you can use a regex tester like this, http://www.solmetra.com/scripts/regex/, to test your pattern against the data you're trying to match against. Looking at your pattern, that would be the opening div and a tag. Basically you're just trying to get your pattern right, so using the regex tester will help you with that. Denno
  2. do a var_dump of the $data variable to check what the data actually is, there might be other characters in there that you didn't expect.
  3. Here you go: http://orac.amt.edu.au/cgi-bin/train/hub.pl Do them in PHP. Beginner tasks right up to advanced tasks. Enjoy! Denno
  4. You need to assign mysql_query() to a variable, and then you can use that as your if condition (or just assign it in the if condition). Then instead of echo'ing succesful, you var_dump or print_r the variable: if($result = mysql_query($sql, $connect)){ var_dump($result); } That will be the quickest way to get output. It's not the prettiest, nor is it using functions that you should be using, but it will work. Denno
  5. Have you tried var_dump'ing or print_r'ing the $variations variable to make sure it is in fact un-serialized in the way you expect?
  6. You need to put your ajax code in the function for the "ok" button. So basically when you press the ok button, whatever is inside the function will run, which currently is to submit the form, which I assume, reloads the page as if it's just a normal page submit. Hope that helps. Denno
  7. Seeing as though you're just using html, and no php, you'd want to use javascript to set a cookie, or to use local storage. You might also be able to set the values in a GET variable, which is appended to the URL in the address bar, and then pull them in on the view.html page using javascript again. Hope that helps you get a start. Denno
  8. Just a thought, you're going to want to use some javascript as well so you can get the local time for the user.. So the page loads, send a quick ajax back to your php script, which then returns the time interval until their midnight time, not the server midnight time (if that makes sense). Using javascript, you can do something like this: var currentTime = new Date(); var hours = currentTime.getHours(); var minutes = currentTime.getMinutes(); Then send hours and minutes back to the php script. I would think the easiest way to work out he time until midnight would be to subtract (hours*60+minutes) from (24*60) -which represents the total number of minutes in a day. Then from php return that total number of minutes, or return a string formatted with hours/minutes, or however you want to display it.. I haven't tried this, it's just an idea of something you could try. If you're struggling getting it going I can write up the code for what I'm trying to explain and show you that instead. Denno
  9. You should add a div after the two coloured divs which has the CSS for clearing the floats. This will allow any content that is after these two divs to be displayed below them on the page, instead of underneath them, as would be the case if the float wasn't cleared. Denno
  10. Give your class "comment-wrapper" a 'float: left' too. Denno
  11. Have you tried just setting your array like this: $data = array(); $data[] = "abc"; $data[] = "test@test.com"; or pretty much exactly as you just wrote it: $data = array("abc", "test@test.com"); However personally I would use the key-value pairs, as that way you know exactly what data you're grabbing in the javascript, instead of just an index number. Denno
  12. Use the same PHP code that would be looping to create the table, to instead populate an array, and then use file_put_csv to create the csv file. You would then return the link to the new csv file on the server to the browser, so it can be downloaded by the user. Hopefully that'll get you started on the right path. Denno
  13. For starters, how come you're calling the randomCode() function with a parameter? You don't actually define that parameter in the function signature The problem you're having is that strlen($characters) will return 13, however the last entry in the string, the 'F', is at position 12, so you need to make it string length subtract 1: $code .= $characters[mt_rand(0, (strlen($characters)-1))] That should help you out. Denno
  14. If you use an editor like Netbeans, it will highlight problems for you.. You haven't closed the curly brace for the very first if statement if (isset($_POST['start_game'])) { Add that curly brace at the end of the file, or wherever the contents of the if finishes, and it will work. Denno
  15. One quick way to see if two files are the same is to compare the md5 hash of them. So if you md5() each file, them compare the hashes in a simple if statement, that will tell you if they are identical or not. $file1 = file("path/to/file1"); $file2 = file("path/to/file2"); $file1Hash = md5($file1); $file2Hash = md5($file2); if($file1Hash == $file2Hash){ //The files are the same }else{ //The files are different } I think that's what you'd be after.. Denno
  16. Try var dumping "$box_office_movies['movies']". You'll see that you do actually get all the movies back..
  17. If you've got an autoloader, then you'll probably need to include the namespace so that the autoloader knows which file to include? That's how I've got mine set up.. An autoloader includes files depending on what use statements are at the top of file.
  18. Pretty straight forward to call the function: $classLogin = new Class_login(); $classLogin->getpost(); Also make sure that you actually include the Class_login.php file, otherwise PHP won't know where Class_login is defined. Denno
  19. You could also use preg_match: if(preg_match("~(.*http://.*)|(.*www\.).*~", $comment)){ //there is some sort of a link in there } But as ayoksus said at the end of their comment, implement a basic captcha. I've done this on my site, I simply ask a math question, to add two numbers that are randomly selected from 0 to 10. Has completely cut off all spam. I made mine update via ajax when an incorrect guess is made, so that someone can't keep guessing on the same math problem, they get one shot at getting each right.. Hope that helps Denno
  20. What doesn't happen that you are expecting to happen? Also, the while loop will only fire one query, because as soon as you call the query, you're redirecting the user to p1.php.. So it will only update one record, but maybe that was your intention?
  21. I thought that might have been the case after I posted that comment.. But I thought I'd leave it there anyway, shows a different way of running the sql query I guess..
  22. For INSERT, you write it like this: INSERT INTO table_name VALUES ("value1", "value2", "value3"); If you have an auto incrementing ID as the first field (which you probably should), then you leave the first value blank: VALUES("", "value1", "value2", "value3"); Also, your semi-colon should still be part of the query string, not outside as it appears you have written it. ...... = '$appointment_id'";" should be ...... = '$appointment_id'; Hope that helps. Denno
  23. When you submit a form, the browser will always 'refresh'. In actual fact, it doesn't refresh, it navigates to the URL that's in the action for the form, if there is no action or no URL, then it navigates to the same page (effectively refreshing the page), and then all of the post variables from the form are available through $_POST. If you want to be able to prevent the page from doing anything if there is an error, then you will need to use javascript to catch the form submit, and prevent it from submitting. I'm not exactly sure how to do it with vanilla javascript, but with jQuery, you do that like this: $("$form_id").submit(evnt){ evnt.preventDefault(); } That will stop the form from submitting, but will also mean you won't get the $_POST variables, so you will need to use AJAX to send those to the script. EDIT: Appears Psycho beat me to it, but we're basically saying the same thing
  24. In a very simply manner, you could do it with 4 divs. You can have one for the top black bar, one for the middle orange bar, and one for the grey body box. Then the fourth will be the logo, which is positioned absolutely, therefore appearing on-top of the other divs. However, as I said, that is very simple, you might need more to be able to do the black trim, but that should get you thinking on the right track. Denno
×
×
  • 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.