don_log Posted September 3, 2009 Share Posted September 3, 2009 Hello Friends I want to ask something to you that i am new to php database and i make a connection of mysql database using php i have setup all the things but i have a problem my database goes correctly connected i have make a table in mysql which have 3 fields id,user,password and i make a form which have two fields user and password when i submit this form values it doesn't store in database just instead of any thing which i write in form it shows empty i am tired of it i checked it 100 or more time but it doesn't save the values i declare variable $altaf=$_post['user'] $hussain=$_post['pass'] .... and the coding i use is that $sql="INSERT INTO users (id,user,password)VALUES('null','$altaf','$hussain')"; mysql_query($sql); id doesn't store it in database so now what i have to do can any body tell me please about that Link to comment https://forums.phpfreaks.com/topic/172934-values-doesnt-saved/ Share on other sites More sharing options...
TeNDoLLA Posted September 3, 2009 Share Posted September 3, 2009 Variables are case sensitive and it is not $_post but it is $_POST['user'] etc. Also in your mysql query you are trying to insert 'null' into id field which is not actually NULL value, what you try to insert now is STRING because it is between single quotes. Try removing also the single quotes from the query around the null. Other (better choice) would to assign your id field as auto_increment in mysql and not giving it any value at all in the INSERTS. Link to comment https://forums.phpfreaks.com/topic/172934-values-doesnt-saved/#findComment-911448 Share on other sites More sharing options...
don_log Posted September 3, 2009 Author Share Posted September 3, 2009 when i write this query insert into user (id,user,password)values ('',altaf,hussain) it stores the values but when i write this instead of altaf $altaf and at place of hussain i use variable $hussain it doesn't store value but when i write like this /$altaf it store only / sign and not form value so what i do is there any solution here tell me please so i can make my database driven website and provide me the cmses thanks Link to comment https://forums.phpfreaks.com/topic/172934-values-doesnt-saved/#findComment-911679 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.