Jump to content

ratcateme

Members
  • Posts

    1,216
  • Joined

  • Last visited

    Never

Everything posted by ratcateme

  1. what about this if($newpassword==$confirmnewpassword && trim($_POST['newpassword']) != '') also notice i change the = to a == Scott.
  2. strpos is returning 0 php treats a 0 as false. try changing the ifs to if (strpos($rank[$team], '1<sup>st</sup>') !== false) { and if (strpos($rank[$team], '2<sup>nd</sup>') !== false) { !== checks the type of value as well. Scott.
  3. you could do a query and output like this $result = mysql_query("SELECT Animal FROM animals") or die(mysql_error()); for($i = 1;$row = mysql_fetch_array($result)!=null;$i++){ echo $row['Animal'] . " is at " . $i; } this uses a for instead of a while so you don't need a ID key although i would recommend putting one in Scott.
  4. have you read the sticky on header issues? you need to move the header command to before any output <html> <head> <title>Order Online</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .style1 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; } --> </style> </head> is output and needs to be after the header command also try to use [ code][/code] tags around code Scott.
  5. also what is error reporting set to? it looks to me like maybe error reporting is not set to show errors check you php.ini file but i dont think that is the problem because you got a error printed out but check it anyway Scott.
  6. do you understand how headers work and how php handles them? headers are sent at the top of a HTTP response. so you cannot send headers after any output has been sent because they had to come first now if you read the error output is started on line 5 "<div id="wrapper">" looking at your code i don't quite see how this line of code works with the rest of the script you need. anyway to i would recommend moving the login checker part of the script to the top on the lines after session_start() that way you would have no problems Scott.
  7. you could go say function get_number($number){ while($number > 9) { $number = array_sum(str_split($number)); } return $number; } $sum1 = get_number($number); $bnum=get_number($split_date[0]); Scott.
  8. a quick observation about that math behind this this will also work $number = 58; $number = $number%9; if($number == 0){ $number = 9; } only problem is if the original number is 0 it outputs 9 so might need another if if you are planning on using it with numbers including 9 Scott.
  9. $number = 58; while(strlen($number)!= 1){ $numbers = str_split($number); $number = 0; foreach($numbers as $add){ $number+=$add; } } echo $number; Scott. edit: guess i was beaten and with a better solution. may never terminate? i can't think of a way off the top of my head for that?
  10. looking at that and the PM i still can't see any reasons why it wont update. the only thing i can think of done but have you tired the echo mysql_affected_rows also are there any other if's around the update section that could stop the update from happening? they might need rechecking also try to add say echo "UPDATING NOW"; on the line after the query to make sure it gets to that line? Scott.
  11. well try this mysql_query("UPDATE available SET sex= 'Male' WHERE id = '1'",$con) or die(mysql_error($con)); echo mysql_affected_rows($con); mysql_close($con); are you sure there is a row with an ID of 1 and a sex of Female? other wise you wont see anything Scott.
  12. you missed in my code there is a , after the query and before $con the line you posted missed that out Scott.
  13. try this code <?php $con = mysql_connect("localhost","*********","**********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("**********", $con); mysql_query("UPDATE available SET sex= 'Male' WHERE id = '1'",$con) or die(mysql_error($con)); mysql_close($con); that will exit if there is a error with your query. and hopefully tell you what is going wrong Scott.
  14. are you sure have you check the source of the html page that your browser is getting? not the source that is on your web server but what is really being sent to the browser Scott.
  15. looking at that i just was thinking you need to escape $'s like this $function = "if(\$me == 2){ echo 'fail';}else{ echo '<input type=\"checkbox\" name=\"list[]\" value=\"\$value\">'; }"; also i think the if and else should be lower case but i don't think it matters Scott.
  16. how do you mean it alters is it at all possible for say one or two vars to alter but the core code remain the same the you could store just those 2 in the database? but if you want to do code inside a var checkout eval you might be able to go say: <?php $function = "If($me == 2){ echo 'fail';}Else{ echo '<input type=\"checkbox\" name=\"list[]\" value=\"$value\">'; }"; eval($function); ?> i think Scott.
  17. can we see the whole thing please. i am guessing you might have a ?> where it shouldn't be Scott.
  18. are you using Apache? if so you need to checkout mod_rewrite there are heaps of tutorials and info about it here http://www.google.com/search?q=mod+rewrite Scott.
  19. well you say on your login page yo put three username in $_SESSION['username'] you check like this <?php session_start(); if(!isset($_SESSION['username'])){ header("Location: login.php"); exit; } //rest of page ?> Scott.
  20. i haven't done to much ajax programming myself but i could see how it would work basically if your php script got the list of new users stored it in session and sent the list to the client. on next request it gets the list checks it with the one saved in session and if they are the same it calls sleep for say 1 second then checks again. now i am not sure how long it would take for the ajax request to timeout so you might have to add limit in the loop so the ajax wont time out but you probably also want to make sure that there is some kind of checking in you ajax so that if one times out then another call is made. Scott.
  21. you need quotes around the last bit like this echo "<h3>Welcome! You are now logged in " . $_SESSION['username'] . "</h3>"; Scott.
  22. you need to rename the $online you are using inside the loop to something else say $onlinearray then change the var in the implode to $onlinearray Scott.
  23. $categorycount=mysql_result($result,$i,"count(category)"); needs to be $categorycount=mysql_result($result,$i,"count( category )"); a better way is do set a name for count like this $query="SELECT DISTINCT category, count( category ) AS count FROM `masterdata` GROUP BY category"; and then retrieving it like $categorycount=mysql_result($result,$i,"count"); Scott.
  24. try adding some headers $headers = 'From: sgfair.com <sgfair@yourhostingnet.com>' . "\r\n"; mail("sung@hotmail.com", "$emailsubject", "Dear $fname $lname, Thank you for registering. Below you will find your username and password that will let you log in and begin to enter rental listings. Username: $email Password: $newpass ", $headers); Scott.
  25. errors like that you just need to read and re-read the line until you can pick something up you are missing a . after $fname also you only the the "or dir" part on the end of a mysql_query call not when you are putting the query into a var Scott.
×
×
  • 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.