Jump to content

aery

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aery's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. what i am trying is to retieve the user info from the table where i log/join in and displaying them in a table using the string
  2. so, am i suggest to create a different table for the user etc..
  3. hi i am getting a error message as Column 'user_name' in field list is ambiguous here is the database $query = 'CREATE TABLE IF NOT EXISTS user_info ( user_id INTEGER NOT NULL, user_name VARCHAR(100) NOT NULL, first_name VARCHAR(100) NOT NULL, last_name VARCHAR(200) NOT NULL, email VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, location VARCHAR(100) NOT NULL, state VARCHAR(50) NOT NULL, zip VARCHAR(10) NOT NULL, PRIMARY KEY (user_id) ) ENGINE = InnoDB'; mysql_query($query, $db) or die (mysql_error($db)); and the php code to retrieve user info from the table <?php $query = 'SELECT user_name, first_name, last_name, email, location, state, zip FROM user_info u JOIN user_info i ON u.user_id = i.user_id WHERE user_name = "' . mysql_real_escape_string($_SESSION['user_name'], $db) . '"'; $result = mysql_query($query, $db) or die(mysql_error($db)); $row = mysql_fetch_array($result); extract($row); mysql_free_result($result); mysql_close($db); ?> <ul> <li>First Name: <?php echo $first_name; ?></li> <li>Last Name: <?php echo $last_name; ?></li> <li>User Name: <?php echo $user_name; ?></li> <li>Email: <?php echo $email; ?></li> <li>Location: <?php echo $location; ?></li> <li>State: <?php echo $state; ?> <li>Zip Code: <?php echo $zip; ?></li> </ul> what does ambiguous means i have google but got different ans. thanks
  4. HI guy i'm having a problem with my registration form can anyone help m out please my php code for submit.php <?php session_start(); include 'db.inc.php'; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect. Check your connection parameters.'); mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db)); // filter incoming values $email = (isset($_POST['email'])) ? trim($_POST['email']) : ''; $username = (isset($_POST['username'])) ? trim($_POST['username']) : ''; $password = (isset($_POST['password'])) ? $_POST['password'] : ''; if (isset($_POST['submit']) && $_POST['submit'] == 'Register') $query = 'INSERT INTO nelyn_user (user_id, username, password, email) VALUES (NULL, "' . mysql_real_escape_string($email, $db) . '", ' . '"' . mysql_real_escape_string($username, $db) . '", ' . 'PASSWORD("' . mysql_real_escape_string($password, $db) . '"))'; $result = mysql_query($query, $db) or die(mysql_error()); $user_id = mysql_insert_id($db); $_SESSION['logged'] = 1; $_SESSION['email'] = $email; header('Refresh: 5; URL=login.php'); ?> and my html code is as <html> <body> <form method="post" action="submit.php" /> <b>Email</b><br /> <input type="text" name="email" id="email" /><br /> <b>UserName</b><br /> <input type="text" name="username" id="username" /><br /> <b>Password</b><br /> <input type="password" name="password" id="password" /><br /><br /> <input type="submit" value=" Register " name="submit" id="submit"/> </form> </body> </html> i'm getting a Notice: Undefined variable: query in C:\xampp\htdocs\submit.php on line 24 Query was empty (this is the line 24 ; $result = mysql_query($query, $db) or die(mysql_error()) when i submit the form i'm using java/js for validation thank
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.