Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. NOW() is a mysql function. you are thinking of time() //wrong //$time = now(); //right $time = time();
  2. there appears to be a fatal error happening. Try turning error reporting on (put this at the TOP of the page) error_reporting(E_ALL); ini_set("display_errors", 1); but the problem is here echo $q there is no semi colon after that line. it should be echo $q; turning on error reporting will help find simple errors like that
  3. not all of them have the dog crosses out by the way, but I see what the problem is I try printing the values of the variables you are testing in the if statements to the screen and see if they have what you expect them to have. for example print $cottage[0]{'pets'}; that should help pinpoint where the problem lies Edit: oops, you posted before i saw it, if your problem is solved, then you can click the mark solved button in the bottom of the thread
  4. nevermind, just tested and its fine but turn error reporting on anyways error_reporting(E_ALL); ini_set("display_errors", 1); a little more information would help too. What exactly is happening? are none of the images showing up? only a couple? blank page?
  5. preg_replace would be ideal as you can make a pattern that will do the replace in 1 go, without having to go back for the exception. As far as the exact pattern goes, i'm somewhat hopeless at regex so another poster will probably have to help with that
  6. Just look at Facebook. Definitely not the first social networking site but definitely the most successful. The most surefire way to not get crushed by competitors is to provide a better service.
  7. if you need to include a page, than you include a page. A programmers gotta do what a programmers gotta do. Efficiency will only come into play if your start including gigantic files. But if you include files with a few lines its basically the same (well a little different) as just copy pasting the lines to wherever the include command is.
  8. The easiest thing to do would probably be to just create a config file with your variables that appear alot of places, and include it where ever its needed
  9. for debugging purposes, try printing the mysql error but adding it to the die clause $makeUserQry = "INSERT INTO wp_users(user_login, user_pass, user_nicename, user_email, user_registered, display_name) VALUES('$username','$pass','$nicename','$email','$time','$displayname')"; $makeUser = mysql_query($makeUserQry); if (!$makeUser) { die("Error. Could not add user to wp_users table. Error: " . mysql_error()); }
  10. first off, thats Javascript, not Java. Secondly, that looks fine, but that javascript doesn't look like it will do anything (unless the external script does something) What do you expect it to do, and what is it actually doing. Have you looked in the error console to make sure there is no errors Have you tried just putting the script directly in the HTML? I don't see why you are putting it in PHP in the first place. on a second glance, you don't need to escape semi colons, so try removing the backslashes that are infront of the semi colons. That will cause a javascript syntax error
  11. you can store it in an array like so $cities = array();//create an empty array while ($cityrow=mysql_fetch_array($citylist)) { $City=$cityrow['City']; //echo $City; $cities[] = $City;//push each city into the city array } that way you can also sort the cities, and do other things with that array that you normally couldn't have done without it
  12. is `status` an integer column? or a varchar column. If its an int, try removing the single quotes around the status in the update query. also, to debug, try printing the value of $_POST['newstatus'] to the screen, and verify it has what you expect it to
  13. A lot of Google's web crawler is written in Python I think. Making a search engine CAN be made in just php/mysql (I think) You will need to create a web crawler, and have it crawl websites. You then need to store the information on your server, and create a good searching algorithm to return results. Just knowing PHP/MySQL may not be sufficient though I suggest you check out this tutorial and try to implement a search feature into your own website before trying to make a search engine. its not easy
  14. Thanks guys! It was the newlines. I did read about the . not matching newlines, but i tried to test if there were newlines in the text (it seems I tested wrong) Again thanks alot. and yeah I also read about "greediness" vs. "laziness", but at this point I was just trying to get a working regex, and probably would have optimized it afterwards. Thanks for the tips though! greatly appreciated
  15. Ok, so i'm finding out im really bad at this. Im trying to capture the stuff inside of a div tag that looks like <div id="userbody"> stuff stuff </div> my pattern looks like this $pattern = '#<div id="userbody">(.)+</div>#i'; I do the following, with the above $pattern //$stuff is the html if (preg_match($pattern, $stuff, $matches)){ print_r($matches); } else { echo "Failure"; } and always get failure. When I change the pattern to just $pattern = '#<div id="userbody">#i'; I seem to get a match, but when I print_r matches, its empty (and I'm not really sure if it should be empty, but since I have no capturing group, I'm assuming thats right) any idea on whats wrong with my pattern?
  16. No prolem, thats what i'm here for. If the problem is fixed, you can also mark the topic as solved by clicking the "mark solved" button at the bottom of the thread
  17. mysqli stands for mysql improved by the way.
  18. ahh ok. Thats called concatenating, and in PHP, the concatenation operator is the dot (.) so what you are looking for is $uniquename = $timestamp.$file_name; you were on the right track the, the plus sign is the concatenation operator for other languages (like javascript)
  19. instead of $add="upload/$file_name"; you could just do $add="upload/$timestamp"; [code=php:0]
  20. your if statement: if($content != 'hub' or $content !='hr' or $content !='crewcenter'){include'content/newmembers.php';} will always be true. Think about it. Its asking, If $content doesn't equal this, or doesn't equal that. If it is equal to "hub" than it won't be equal to "hr" so it will still include newmembers.php perhaps you mean to use and instead of or if($content != 'hub' && $content !='hr' && $content !='crewcenter'){include'content/newmembers.php';}
  21. The point of OOP is to have different objects that do 1 job, and use them together. You probably want to create another class to access the database, and have the validate class interact with the database class to insert data (or alternatively, use the database class to validate the info by interacting with the validate class before inserting)
  22. you can get a timestamp using the time() function. $timestamp = time();
  23. Oh i see, that site is just calling me a douche bag. Its too late for websites to be calling me douche bags, I'm going to sleep
  24. Usually take a smoke break. that generally helps me think
  25. it just took what I entered in the name field and spit it back at me. am I missing something...
×
×
  • 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.