AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
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.
-
Prevent duplicate content in database does NOT work!
AyKay47 replied to angelali's topic in PHP Coding Help
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. -
Err. method="post" Not action
-
Do both files exist in your server? The example was pseudo code.
-
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());
-
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.
-
Let us know when this has been solved.
-
looks like you are trying to get a property from an array. where is $rsOptions[$j] coming from? Post the relevant code.
-
I think it would be best if you glanced at the switch statement syntax: http://php.net/manual/en/control-structures.switch.php
-
\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?
-
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.
-
Prevent duplicate content in database does NOT work!
AyKay47 replied to angelali's topic in PHP Coding Help
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. -
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.
-
Prevent duplicate content in database does NOT work!
AyKay47 replied to angelali's topic in PHP Coding Help
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 } -
Prevent duplicate content in database does NOT work!
AyKay47 replied to angelali's topic in PHP Coding Help
then you should toss them out. -
Prevent duplicate content in database does NOT work!
AyKay47 replied to angelali's topic in PHP Coding Help
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) -
Prevent duplicate content in database does NOT work!
AyKay47 replied to angelali's topic in PHP Coding Help
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. -
<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"
-
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
-
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?
-
This str_replace for an external file isnt working!
AyKay47 replied to Allenph9's topic in PHP Coding Help
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. -
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
-
http://php.net/manual/en/language.references.php
-
This str_replace for an external file isnt working!
AyKay47 replied to Allenph9's topic in PHP Coding Help
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. -
so, what exactly is your issue? Are the errors not being displayed correctly when they should be?