Ok heres the problem. I have a user database that works fine when they register thier username and password it is getting same in my database.
Now i want the user to have stats. This is the idea when they sign up it saves thier username and password but in the database it it has 6 rows one for ID,Username,Password,Power,Attacks,Money. Now the power,attacks and money are all defualts wich start thier profile off with.
i.e(ID=1 Username=me Password=w/e Power=0 Attacks=0 Money=0)
But when i put the power,attacks, and money fields in thier and test the registery it tells me the row vaule and coulm value do not match. Here is the code for the register.php that inserts the registered info into the database
Any help would be great thanks.
Now i want the user to have stats. This is the idea when they sign up it saves thier username and password but in the database it it has 6 rows one for ID,Username,Password,Power,Attacks,Money. Now the power,attacks and money are all defualts wich start thier profile off with.
i.e(ID=1 Username=me Password=w/e Power=0 Attacks=0 Money=0)
But when i put the power,attacks, and money fields in thier and test the registery it tells me the row vaule and coulm value do not match. Here is the code for the register.php that inserts the registered info into the database
| Code: |
| <?php
include("connect.php"); include("config.php"); // connect to the mysql server $link = mysql_connect($server, $db_user, $db_pass) or die ("Could not connect to mysql because ".mysql_error()); // select the database mysql_select_db($database) or die ("Could not select database because ".mysql_error()); // check if the username is taken $check = "select id from $table where username = '".$_POST['username']."';"; $qry = mysql_query($check) or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($qry); if ($num_rows != 0) { echo "Sorry, there the username $username is already taken.<br>"; echo "<a href=register.html>Try again</a>"; exit; } else { // insert the data $insert = mysql_query("insert into $table values ('NULL','".$_POST['username']."', '".$_POST['password']."')") or die("Could not insert data because ".mysql_error()); // print a success message echo "Your user account has been created!<br>"; echo "Now you can <a href=index.html>log in</a>"; } ?> |
