Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. when picking just one entry with array rand, it returns the key of the array, not the value at that key, so the last line to print $rr[$randomnumber];
  2. yeah BBCode is probably the best way, although I guess you could htmlentities everything, and than go back and un-entity the tags you want. but either way its about the same TBH
  3. ok well then after that if statement stop the script
  4. I think a referrer needs to have linked to your website. Or is that what you're talking about (as in a link from a search?)
  5. add "$this->" before any member function calls inside your class and it should work
  6. Ok, i created a function that will add a specific key to any position on the array, and sort it accordingly. I believe its what you are asking for. the function is below function putPosition($arr, $pos, $key){ $newarr = array(); $added = false; foreach($arr as $k=>$v){ if ($k == $pos){//if we are at the correct key, add the value $newarr[] = $arr[$key]; $added = true;//verify that the key key has been added in its place } if ($added){//check if its been added //if so check if we are on its original key if($k == $key){ //if so, continue continue; } else { $newarr[] = $v; } } else { $newarr[] = $v; } } return $newarr; } the logic is pretty simple here are some test runs I did $array = array("one", "two", "three", "four", "five", "six", ">9000", "eight", "nine", "ten"); print_r($array); echo "<br />"; print_r(putPosition($array, 0, 3)); echo "<br />"; print_r(putPosition($array, 1, 3)); With the following results in order Array ( [0] => one [1] => two [2] => three [3] => four [4] => five [5] => six [6] => >9000 [7] => eight [8] => nine [9] => ten ) Array ( [0] => four [1] => one [2] => two [3] => three [4] => five [5] => six [6] => >9000 [7] => eight [8] => nine [9] => ten ) Array ( [0] => one [1] => four [2] => two [3] => three [4] => five [5] => six [6] => >9000 [7] => eight [8] => nine [9] => ten ) Is that sort of what you asked for?
  7. echo $gender before the switch statement and make sure it actually has data in it. By the way, using a switch statement with 2 possible tests is kind of pointless. Switch is usually used when you have many tests that need to be preformed (I usually use them for over 3 or 4) and your code would get nasty with all the if statements. For your case, you could shrink that case statement to one line, using a ternary operator (http://us2.php.net/ternary) $genderdb = ($gender = "Male") ? "M" : "F";
  8. What happens when you run the script? try posting more code, because assuming that $Class is set to the correct post variable, that should work
  9. Problem is you are using post, and not get. Values passed via the URL are stored in the $_GET array. so change the following: The borough is: <?php echo $_POST["select"]; ?> to The borough is: <?php echo $_GET['select']; ?> and it should work
  10. mysql_query("update tbnlmembers set pass='$upassword' where pass='$pass'") or I dont see anywhere you set the $pass variable, so try using the username instead, like mysql_query("update tbnlmembers set pass='$upassword' where user='$username'") or Also the action of your reset password form should be the send-password.php page so <form name="myform" action="send-password.php" method="post"> Username: <input type="text" name="user" size="15" /><br /> <input type="submit" name="submit" value="Submit" /> </form> [/code[
  11. hmmm as far as giving you specific projects, maybe try looking for online courses or something. I know of w3schools and tizag (two of my favorite php tutorial sites) but those are more or less how to use certain functions, and not really entire projects starting from small to large. However they do have very good examples, so you could use the examples they give as sort of starting points for projects, and go from there. However if you want my advice for where to start on a project I would create a site with a simple login system. Perhaps add a news system. then slowly add more and more things for users to be able to do, like edit their profile, comment on stuff, etc. etc. and then when you understand the core basics, you can start tackling harder stuff like discussion forums, uploading pictures/avatars, creating administrative functions, etc.
  12. hmm.. that shouldnt be making the key increment. It should make the value of that specific entry in the array increment. try deleting the space between your square brackets. I don't know why that would be causing an error, but i've never actually seen anyone put spaces between everything like that so it might be confusing things
  13. assuming $select is a string, change your query to "SELECT * FROM subjects WHERE borough = '$select' " also, $query isn't a valid mysql_resource because well... it isn't a mysql_resource, its a string. you have to preform a mysql_query with that string in order to get data from the table so chagne $query to $query= mysql_query("SELECT * FROM subjects WHERE borough = '$select' "); Hope that helps
  14. well, in this script whatever value your session['id'] had was erased when you instantiated it as a new array. so I don't think that the if statement will ever run true. Where exactly is your session['id'] getting its values from? if its getting them from another page, and you are sure that the values are there (and being added correctly), than there is no need to instantiate it as a new array, as it is already an array
  15. Go to the w3school php tutorials and follow them exactly as they are laid out. They go from simple to advanced for a reason My advice would be to just create a very simple website, and as you learn more add more. Don't try to jump into the advanced stuff until you are really happy with the results of your simple stuff. Besides you can always make your simple scripts more advanced and badass over time. Hope that helps!
  16. nope, just tested the following on my local server <html> <body> <form action="mailto:mikesta707@yahoo.com" method="POST" enctype="multipart/form-data"> <input type="text" name="text" /> <input type="submit" value="Submit" /> </form> and Outlook expressed popped up. Maybe its some behavior that wasn't around in previous versions of HTML (I don't remember either, been a long time for me too ) But for OP, do you have PHP installed on your internal server?
  17. $text_to_search = "Mark\'s Shop"; can you just do that?
  18. http://www.phpfreaks.com/forums/index.php/topic,200925.0.html
  19. well, you would probably have to do a query, get all the id's from the table, and process the information to find any gaps. once you do that, you can just set any new ids as in between those gaps, but that would kind of defeat the purpose of auto-increment because you wouldn't even really be using its functionality if you did that. Can I ask why you need there to be no gaps? Edit: There may also be some fancy SQL commands you could do, but i'm not sure about that
  20. Yeah but that will try to open your default mailing programming (For example on a window's machine, it will open outlook express), and the form data may not even appear in the email itself (I just did a test, and my form data did NOT show up on the email itself) Plus, for me, and many user's I know, If I click a link that starts outlook express, I quickly close everything and never return to that site. However, if its for your job, and they use outlook express, than that may not be a bad way to go, and in fact would probably be the easiest way to go
  21. before you send the variables, you should use $title = urlencode($title); Then append it to the URL http://whatever.com/?title=$title When you read it, you will need to do $title = urldecode($_GET['title']); taken from : http://www.webxpertz.net/forums/archive/index.php/t-35671.html
  22. The action attribute for HTML forms points to a page where a scripting language (Like PHP) does some sort of processing. So you are definitely going to have to use PHP to mail the information from the form to your email address. Its quite simple though. here is a basic php and html forms tutorial: http://www.tizag.com/phpT/forms.php and a php mail tutorial: http://www.w3schools.com/PHP/php_mail.asp
  23. This is probably a CSS problem, not really a PHP problem
  24. oops totally missed the i, yeah thats a much better idea
  25. without seeing any code I'm forced to say yes they seem to be clashing into each other. Whats wrong with them having different actions?
×
×
  • 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.