kadamabhijeet_91 Posted December 19, 2008 Share Posted December 19, 2008 I have created a registration form.The data entered in the registration form must get updated in the database.after i enter the data im also getting no error.but if i check the database no data is visible in the database.im attaching a file pls help me. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/ Share on other sites More sharing options...
gaza165 Posted December 19, 2008 Share Posted December 19, 2008 i dont see where you are declaring the variables that you want to put in the db. where is the data coming from you want to put in? Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-719527 Share on other sites More sharing options...
kadamabhijeet_91 Posted December 20, 2008 Author Share Posted December 20, 2008 Here is the coding Register.php page <?php include 'config.php'; include 'opendb.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="add_user.php"> <p> </p> <table width="523" height="223" border="0"> <tr> <td width="150"><div align="center"><strong>Name : </strong></div></td> <td width="357"> <div align="left"> <input type="text" name="name_textbox" id="name_textbox" /> </div></td></tr> <tr> <td><div align="center"><strong>Age : </strong></div></td> <td> <div align="left"> <input type="text" name="age_textbox" id="age_textbox" /> </div></td></tr> <tr> <td><div align="center"><strong>Gender : </strong></div></td> <td><div align="left"> <select name="list_gender" id="list_gender"> <option>Male</option> <option>Female</option> </select> </div></td> </tr> <tr> <td><div align="center"><strong>Username : </strong></div></td> <td><div align="left"> <input type="text" name="username_textbox" id="username_textbox" /> </div></td> </tr> <tr> <td><div align="center"><strong>Password : </strong></div></td> <td><div align="left"> <input type="password" name="password_textbox" id="password_textbox" /> </div></td> </tr> </table> <p> <input type="submit" name="button" id="button" value="Submit" /> </p> <p> </p> </form> </body> </html> add_user.php Page <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'demojoomla'; $dbname = 'user'; mysql_pconnect("localhost", "root", "demojoomla")or die("cannot connect server "); mysql_select_db("user")or die("cannot select DB"); $ipaddress=$_SERVER['REMOTE_ADDR']; //IP Address $sql="INSERT INTO user_tbl(name, age, gender, username, password, ipaddress)VALUES('name_textbox', 'age_textbox', 'list_gender, 'username_textbox', 'password_textbox', 'ipaddress)"; $result=mysql_query($sql); //check if query successful if($result){ echo "Successful"; echo "<BR>"; echo "<a href='login.php'>View Login Page</a>"; // link to view guestbook page } else { echo "ERROR"; } mysql_close(); ?> What i have to do ??? Please help me .... ??? ??? Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-720163 Share on other sites More sharing options...
jonsjava Posted December 20, 2008 Share Posted December 20, 2008 um.... I think this will fix the issue, if you posted the actual code: <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'demojoomla'; $dbname = 'user'; mysql_pconnect("localhost", "root", "demojoomla")or die("cannot connect server "); mysql_select_db("user")or die("cannot select DB"); $ipaddress=$_SERVER['REMOTE_ADDR']; //IP Address $age = mysql_real_escape_string($_POST['age_textbox']; $gender = mysql_real_escape_string($_POST['list_gender']; $username = mysql_real_escape_string($_POST['username_textbox']; $password = mysql_real_escape_string($_POST['password_textbox']; $ip = mysql_real_escape_string($_POST['ipaddress']; $sql="INSERT INTO `user_tbl`(`name`, `age`, `gender`, `username`, `password`, `ipaddress`)VALUES('name_textbox', '$age', '$gender, '$username', '$password', '$ip');"; $result=mysql_query($sql); //check if query successful if($result){ echo "Successful"; echo "<BR>"; echo "<a href='login.php'>View Login Page</a>"; // link to view guestbook page } else { echo "ERROR"; } mysql_close(); ?> Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-720169 Share on other sites More sharing options...
redarrow Posted December 20, 2008 Share Posted December 20, 2008 $name_textbox << add a $ add some error checking mysql_error() Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-720181 Share on other sites More sharing options...
kadamabhijeet_91 Posted December 20, 2008 Author Share Posted December 20, 2008 Thank You Johns Java Its working fine As you told that you are php programmer, do you know any THE BEST php & mysql Books ? I want best of best. money is not an issue Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-720187 Share on other sites More sharing options...
jonsjava Posted December 20, 2008 Share Posted December 20, 2008 Thank You Johns Java Its working fine As you told that you are php programmer, do you know any THE BEST php & mysql Books ? I want best of best. money is not an issue I have a copy of "Beginning PHP 5 and MySQL: From Novice to Professional" on my shelf. I reference it more than any of my other 30 or so php books. (ISBN 1-893115-51- It has a good bit of information in it. I highly recommend it to people new to PHP. My version went for about $40USD, so it's not too bad on the wallet either. Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-720190 Share on other sites More sharing options...
redarrow Posted December 20, 2008 Share Posted December 20, 2008 http://www.freewebmasterhelp.com/tutorials/php http://www.php.net/ http://www.w3schools.com/PHP/DEfaULT.asP all u need it enough. Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-720192 Share on other sites More sharing options...
kadamabhijeet_91 Posted December 20, 2008 Author Share Posted December 20, 2008 Now i want to fetch out the data from database Following is the code for result.php <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'demojoomla'; $dbname = 'user'; mysql_pconnect("localhost", "root", "demojoomla")or die("cannot connect server "); mysql_select_db("user")or die("cannot select DB"); $sql="SELECT * FROM user"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table width="794" border="1"> <tr> <td><div align="center">ID</div></td> <td><div align="center">NAME</div></td> <td><div align="center">AGE</div></td> <td><div align="center">GENDER</div></td> <td><div align="center">USERNAME</div></td> <td><div align="center">PASSWORD</div></td> <td><div align="center">IPADDRESS</div></td> </tr> <tr> <td><div align="center"><?php echo $rows['id'];?></div></td> <td><div align="center"><?php echo $rows['name'];?></div></td> <td><div align="center"><?php echo $rows['age'];?></div></td> <td><div align="center"><?php echo $rows['gender'];?></div></td> <td><div align="center"><?php echo $rows['username'];?></div></td> <td><div align="center"><?php echo $rows['password'];?></div></td> <td><div align="center"><?php echo $rows['ipaddress'];?></div></td> </tr> </table> </body> </html> I am using Dream weaver cs3 and phpDesigner 2008 Which software is FANTASTIC to use who shows design page and also coding page as this feature is there in Dreamweaver but in phpDesigner, i can have only coding side Again, money is not issue, Do you have skype account ? Please send me Thanks Link to comment https://forums.phpfreaks.com/topic/137669-database-not-getting-updated/#findComment-720196 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.