You are here: Help to retrieve data from mysql « PHP Programming Language « IT news, forums, messages
Help to retrieve data from mysql

Posted by icetilloveu@gmail.com on 08/22/07 23:34

i have this code:
<?php
// 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");
exit;}

// 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 =
'$usercheck'")
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");
exit;

}


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

// 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация