Jump to content

Altrozero

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by Altrozero

  1. I haven't read the whole script but one problem appears to be that you are checking bytes and calling them kb. $_FILES["photo"]["size"] < 10000 will check that it is less than (roughly) 10kb not 10,000kb
  2. Use javascript or save previous input to either a database or a users session/cookie. There are a few tutorials around to save data.
  3. The line seems fine, are you sure there is data in $row['user_id']? Could it by null?
  4. I thought that is what you wanted? You haven't really explained what the output should look like? Depending on the users input.
  5. Hidden input fields could be used instead if you really wanted. you could go in your HTML <form method="post" action=""> <input type="hidden" value="value1" name="one" /> <input type="hidden" value="value2" name="two" /> <input type="hidden" value="value3" name="three" /> <input type="hidden" value="value4" name="four" /><input type="submit" value="submit" /> </form>
  6. Not pretty, but it works. for ($m = 1; $m <= 12; $m++) { $use = $m; if($m < 10) $use = '0'.$m; echo $use; }
  7. Try updating your version of PHP? I believe there is a current bug open on this error. http://bugs.php.net/bug.php?id=31037
  8. In your if statement you need to use a double == sign e.g if($pin == "1111") { } else if ($pin == "2222") { }
  9. This should work if(empty(trim($value)) { //Made up of just white spaces } else { //Has other content }
  10. In this case you can use something like this. Not exactly fast but a simple way of doing it in just msql UPDATE results, (SELECT id, (SELECT tb2.result FROM results as tb2 WHERE tb2.new_id = tb1.new_id ORDER BY result ASC LIMIT 1) as result FROM results as tb1) as tb3 SET results.final_result = tb3.result WHERE results.id = tb3.id
  11. Just the rest of your code, I basically replaced the line if ($phase = mysql_result(mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"),0,0)) with what I posted. It should stop giving you the warning then.
  12. Do that outside of regular expressions with the function nl2br(); $string = nl2br($string);
  13. Good good Try this article for securing your code http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php
  14. It probably means that the row and field you are requesting doesn't exist, in other words when no rows are found in your query, mysql_result can't get anything. You can solve this my going... $phase = false; $query_result = mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"); if(mysql_num_rows($query_result) > 0) $phase = mysql_result($query_result, 0, 0); if($phase !== false) { ....
  15. There are several problems with the script that I can see, first of all unless you have specified localhost as a const someone else you need to put quotation marks around it, mysql_connect('localhost',$username,$password); Second of all you are running the query $query before you have setup the query so switch the lines so they are in this order $query = "INSERT INTO data1 VALUES ('$_POST[name]','$_POST','$_POST[phone]','$_POST[country]','$_POST[age]')"; mysql_query($query); Thirdly you need to do error validation on the text going in to the query or you are leaving your database open to SQL injection. I would suggest reading up on it before you put this script online. Hope this helps. If you continue to have problems disable your redirect via the header function so you can see if any other errors are poping up.
  16. Change the last line of the function to return $message should work then.
  17. http://uk3.php.net/manual/en/language.oop5.paamayim-nekudotayim.php It basically allows you to access static functions and const variables in a class without having to create an instance of it. e.g you could go class obj { const var = 'test'; } echo obj::var;
  18. A kinda hacky way would be <?php echo substr($row_rs1['updtime'],0,5); ?>
×
×
  • 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.