Help to retrieve data from mysql

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
i have this code:
// Connects to your Database
mysql_connect("localhost") or die(mysql_error());
mysql_select_db("eurialz") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !
$_POST['name'] | !$_POST['gender'] ) {
header("location: register.php?error=yes");

// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username =
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {

header("location: register.php?error2=yes");


// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
header("location: register.php?error3=yes");

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);

// now we insert it into the database
$insert = "INSERT INTO users (username, password, name, gender,
dobmonth, dobday, dobyear)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".
$_POST['name']."', '".$_POST['gender']."', '".$_POST['dobmonth']."',
'".$_POST['dobday']."', '".$_POST['dobyear']."')";
$add_member = mysql_query($insert);
header("Location: newmember.php");

Can anyone help me to retrive the data from the db.Each new row from
the db. has an unique id number.thank you

Re: Help to retrieve data from mysql wrote:
Quoted text here. Click to load it

1. Don't use addslashes().  Use mysql_real_escape_string() instead.

2. Get the data with a SELECT statement.  What's your problem?

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline