Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by AyKay47

  1. debugging your query will show an error upon failure of the query. If you did not receive any errors using the code I have posted, the problem is not with your query.
  2. Pika has kindly laid out a list of things that should be done differently for you. Take the time to research each of these things and solve them yourself.
  3. Err. method="post" Not action
  4. Do both files exist in your server? The example was pseudo code.
  5. You would declare only the field values that you want to update. If this is not working for you, add a little debugging. $sql = "UPDATE prices SET price1='$price1', price2='$price2', date='$date' WHERE id='$id'"; mysql_query($sql) or die($sql . "<br />" . mysql_error());
  6. AyKay47

    Preg stuff

    That is not what that regex says at all. You do not have your characters grouped in character classes. [a-zA-Z\d] The regex that you have is not doing what you think it is, and no valid email will pass that.
  7. Let us know when this has been solved.
  8. looks like you are trying to get a property from an array. where is $rsOptions[$j] coming from? Post the relevant code.
  9. I think it would be best if you glanced at the switch statement syntax: http://php.net/manual/en/control-structures.switch.php
  10. AyKay47

    Preg ques

    \d = digits [0-9] [a-zA-Z] = letters (case insensitive) [\s\t] = white space (matches a space and tab respectfully) [^\s\t] = non-white space (matches anything other than the above white space characters) what does this have to do with your original question?
  11. but you referred the OP to articles, which involve more reading. Reading is an important factor in learning. Yes this is caused by output being sent to the browser before setcookie() is being called. If there is no "seen" output being sent, the text editor you are using could be using a BOM (Byte Order Mark) for encoding.
  12. On top of everything that has been said, use the code that I have provided in my last reply to verify the data in the SQL statement.
  13. AyKay47

    Preg ques

    well, without the string ending anchor. A string like ",hey whats up" would match. If you want the alphanumeric character preceded by the comma to be the only match, then yes you need the ending anchor.
  14. then this condition: if(mysql_num_rows(mysql_query($verify)) != 0) { echo '<p class="fail">This email or username is already taken!</p>'; } is returning FALSE, for some reason. The values are not comparing correctly to the values in the databse. Echo your SQL statement and verify the values. if(mysql_num_rows(mysql_query($verify)) != 0) { echo '<p class="fail">This email or username is already taken!</p>'; } else { echo $verify; exit; //rest of code will not get executed }
  15. then you should toss them out.
  16. because $verify is an SQL statement, a mysql_query resource needs to be passed to mysql_num_rows. e.g: $verify = "SELECT * FROM login WHERE emailaddress = '$email' AND username = '$uname'"; if(mysql_num_rows(mysql_query($verify)) != 0)
  17. this line: if (mysql_num_rows(mysql_query("SELECT * FROM login WHERE emailaddress = '$email' username = '$uname'"))) { should read: if (mysql_num_rows(mysql_query("SELECT * FROM login WHERE emailaddress = '$email' AND username = '$uname'"))) { you forgot the AND in the SQL statement.
  18. <input type="text" name"test" id="test"> needs to read: <input type="text" name="test" id="test"> instead of name"test" it needs to be name="test"
  19. 1. escape all user data before using in an SQL statement using mysql_real_escape_string (assuming your db server is MySQL). This will prevent SQL injection and XSS. however it is preferred to use PDO with prepared statements. 2. Do not use $_SERVER['PHP_SELF'] as a forms action, this will leave your forms open to XSS. 3. Make sure files and directories have the proper permissions so user cannot view and/or tamper with them. There is a list of things that you can do for added security, I'm sure other users will list more. I will leave you with some reading from php.net on the security subject: http://php.net/manual/en/security.php
  20. no. If you are not sure of the age data and you need a tight regex you can use this. $string = '<b>Age:</b> 16'; if (preg_match('~^<b>Age:</b> ([1-9][0-9]?|10[0-5])$~', $string, $match)) { //max age 105 echo ((int)$match[1] < 18) ? 'minor' : 'adult'; } else, if you are sure of the data, you can use this: $string = '<b>Age:</b> 16'; if (preg_match('~^<b>Age:</b> (\d{1,3})$~', $string, $match)) { echo ((int)$match[1] < 18) ? 'minor' : 'adult'; } or even: $pattern = '^<b>Age:</b> (\d+)$'; curious, where are you getting the contents of $line?
  21. yes, follow what PFM said. In this case, if the OP had the error settings correct, he should have received an "undefined variable" error and an invalid handle error.
  22. Every language has a different flavor of regex. Things that are valid in one might be invalid in another. For your reading: http://www.regular-expressions.info/refflavors.html
  23. http://php.net/manual/en/language.references.php
  24. in the fread() call, you have the handle set to $_fh1, when it should be $fh1. You should always debug your code, that way little things like this are much easier to spot.
  25. so, what exactly is your issue? Are the errors not being displayed correctly when they should be?
×
×
  • 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.