Please help me get this done since it's driving me crazy already.
I'm new to this whole process so what seems easy for you might be a nightmare for me, and no, google didn't help :(
So, i'm having one mysql table named member with the following structure:
- mem_id
- username
- password
- firstname
- lastname
- titlu (title)
- descriere (description)
- joy (integer)
- comm
I'm parsing user details using execute.php looking like this:
<?php
session_start();
include('db.php');
$username=$_POST['username'];
$result = mysqli_query($db,"SELECT * FROM member WHERE username='$username'");
$num_rows = mysqli_num_rows($result);
if ($num_rows) {
header("location: index.php?remarks=failed");
}
else
{
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$username=$_POST['username'];
$password=$_POST['password'];
mysqli_query($db,"INSERT INTO member(firstname, lastname, username, password)VALUES('$firstname', '$lastname', '$username', '$password')");
header("location: index.php?remarks=success");
}
?>
Now i have another form that inserts gift details and must continue filling the same row in mysql.
I've tried the following but no luck:
<?php
session_start();
include('db.php');
$username=$_POST['username'];
$result = mysqli_query($db,"SELECT * FROM member WHERE username='$username'");
$num_rows = mysqli_num_rows($result);
if ($num_rows) {
header("location: index.php?remarks=failed");
}
else
{
$titlu = $_POST['titlu'];
$descriere = $_POST['descriere'];
$joy = $_POST['joy'];
$comm = $_POST['comm'];
$sql = "UPDATE member
SET titlu = '".mysql_real_escape_string($_POST[titlu])."'
SET descriere = '".mysql_real_escape_string($_POST[descriere])."'
SET joy = '".mysql_real_escape_string($_POST[joy])."'
SET comm = '".mysql_real_escape_string($_POST[comm])."'
WHERE username='".mysql_real_escape_string($_POST['username'])."'";
header("location: welcome.php?remarks=success");
}
?>
Thank you very much for your support!