|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-17 07:15 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 01:00:01 2025 UTC |
What im trying to do, is check to see if the person is new to signing up, but the way i did it made me think its a bug. Think about it like this would this work, (yes) <? $new = 1; if ($new = 1) echo "it worked"; ?> Ok, so you know that works, and i know that works, but what about this. picture a login form <form method=post action=login_go.php> <input type=test name=username> <input type=submit> </form> You enter your username, and push submit, now you are in login_go.php with the value carryed by your username You write <? $link = mysql_connect("localhost", "dbuser", "dbpass") or die("Could not connect"); $get = mysql_select_db("dbname",$link) or die("Could not select Database"); $user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username='$username';")); //$username from the form if ($user[new] == "1") // say there was a feild in the table users called new {echo "worked";} ?> That would not work?, why its so right, theres nothing wrong with that code, but!, now if u add a w to new in the database feild, and add a w to user[new] it will work. I have figure out how to get around it by simply added another w, or just changing the word new all together. Is new a functions of some type, or is it a bug when you use it like that. It really doesnt make sense to me, and the people who ive ask about this. I hope you can give me a anwser to this question, cause i am very curious, and so are my friends.