Try it like this, now, all the fields are required, so no data will be stored to database if user doesn't fill all the fields.
but use it ony on your small home app, don't put it in production server, since it's still badly vulnerable to injection.
if(isset($_POST['phone'])
&& isset($_POST['tagline'])
&& isset($_POST['activity'])
&& isset($_POST['about'])){
$phone = $_POST['phone'];
$tagline = $_POST['tagline'];
$activity = $_POST['activity'];
$about = $_POST['about'];
$date=date('d-m-y');
$status='ok';
$con=mysqli_connect("localhost","root","","database");
mysqli_query($con,"UPDATE owners
SET phone='$phone', tagline='$tagline',status='$status',activity='$activity',about='$about',date='$date'
WHERE username='deiin'");
mysqli_close($con);
}
Or like this, activity and about would be optional:
if(isset($_POST['phone'])
&& isset($_POST['tagline']){
$phone = $_POST['phone'];
$tagline = $_POST['tagline'];
if(isset($_POST['activity'])) $activity = $_POST['activity'];
else $activity = '';
if(isset($_POST['about'])) $about = $_POST['about'];
else $about = '';
$date=date('d-m-y');
$status='ok';
$con=mysqli_connect("localhost","root","","database");
mysqli_query($con,"UPDATE owners
SET phone='$phone', tagline='$tagline',status='$status',activity='$activity',about='$about',date='$date'
WHERE username='deiin'");
mysqli_close($con);
}
But again, be aware that there's huge security hole in this code, so don't put this on production server. If someone wrote ' quote in the form, it would be inserted in the sql query and it would be the ending quote there, thus whatever following the quote would be interpreted as commands for sql. That way every joker around could delete your whole database in a second. use mysqli_real_escape_string() or prepared statements
EDIT:
How to use mysqli_real_escape_string():
instead of for example $phone = $_POST['phone'];
, you enclose it in mysql_real_escape_string() like this:
$phone = mysql_real_escape_string( $_POST['phone'] );
Couldn't be simpler, could it? :)
and remember to quote everyhing in query, like you do:
UPDATE owners SET phone= ---> '$phone' <--- /*those quotes are
important for it to work, remember to keep them there */
I don't want to explain prepared statements, because the procedural syntax is weird and the OOP syntax would probably look even weirder to you.