Jay2391 Posted September 27, 2006 Share Posted September 27, 2006 All I am trying to do is to input data from a PHP page to my database but it is not working looking for a new set of eyes...Database: mainlydigitalTable: usersserver: localhosthot id: hostpass: 12345 >:(<HTML><head><title>MD Register</title></head><body><?php$self = $_SERVER['PHP_SELF'];$userid = $_POST['userid'];$name = $_POST['name'];$last = $_POST['last'];$email = $_POST['email'];$state = $_POST['state'];$country = $_POST['country'];$accname = $_POST['accname'];$password = $_POST['password'];$code = $_POST['code'];$news = $_POST['news'];$agreed = $_POST['agreed'];$domain = "localhost";$user = "root"; $pass = "12345";if( $userid and $name and $last and $email and $state and $country and $accname and $password and $code and $news and $agreed){ $conn = mysql_connect($domain, $user, $pass); $rs = mysql_select_db("mainlydigital", $conn) or die( "Err:Db" ); $sql = "insert into users (userid, name, last, email, state, country, accname, password, code, news, agreed) values ( $userid, \"$name\", \"$last\", \"$email\", \"$state\", \"$country\", \"$accname\", \"$password\", \"$passwordv\", \"$code\", \"$news\", \"$agreed\")"; $rs = @mysql_query( $sql, $conn ); if( $rs ){ echo( "Record added:$userid <br> $name <br> $last" ); }}?><form action="<?php echo( $self ); ?>" method="post"><br> ID: <input type="text" name="id" size="3"><br> First Name: <input type="text" name="name" size="30"> Last Name: <input type="text" name="last" size="30"><br> E-Mail:<input type="text" name="email" size="50"><br> City & State: <input type="text" name="state" size="30"> Country: <input type="text" name="country" size="30"><br><br> Account Name: <input type="text" name="accname" size="30"><br><br> Enter Password (8 to 12 Characters):<br><input type="text" name="password" size="30"><br> Enter a four Digit Numeric Code:<br><input type="text" name="code" size="30"><br><br> Will you like email news about this site:<br><input type="text" name="news" size="30"><br> Confirm you have read all the rules and regulations <br>and you agreed to obey by those:<br><input type="text" name="agreed" size="30"><br><br><br><input type="submit" value="Register"></form></body></HTML> Link to comment https://forums.phpfreaks.com/topic/22286-simple-input-for-data-base/ Share on other sites More sharing options...
alpine Posted September 27, 2006 Share Posted September 27, 2006 First of all, dont surpress with @ when testing....replace --> $rs = @mysql_query( $sql, $conn );with --> $rs = mysql_query( $sql, $conn ) or die(mysql_error());and see what it says.. Link to comment https://forums.phpfreaks.com/topic/22286-simple-input-for-data-base/#findComment-99815 Share on other sites More sharing options...
Jay2391 Posted September 27, 2006 Author Share Posted September 27, 2006 No erros...at all ...I am on php5 BTW Link to comment https://forums.phpfreaks.com/topic/22286-simple-input-for-data-base/#findComment-99823 Share on other sites More sharing options...
alpine Posted September 27, 2006 Share Posted September 27, 2006 mismatch in number of cols compared to variables in query - missing "passwordv"$sql = mysql_query("insert into users (userid, name, last, email, state, country, accname, password, [red]passwordv[/red], code, news, agreed) values ('$userid', '$name', '$last', '$email', '$state', '$country', '$accname', '$password', '$passwordv', '$code', '$news', '$agreed')") or die(mysql_error());But if userid is auto incr primary key, you should also remove this Link to comment https://forums.phpfreaks.com/topic/22286-simple-input-for-data-base/#findComment-99843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.