Pass the screen name to the main page after php ajax login is successful?

<?php
header("Access-Control-Allow-Origin: *");
$con = mysqli_connect("localhost","root","0123456zp");
if(! $con )
{
    die(": " . mysqli_error($con));
}

mysqli_select_db($con,"xsmf");
$sql = "select * FROM user where name = "$_POST[name]" and pwd="$_POST[pwd]"";
$result = mysqli_query($con,$sql );
$rows=mysqli_num_rows($result);

if($rows){
    session_start();

    $_SESSION["name"] = $_POST[name];
    $_SESSION["pwd"] = $_POST[pwd];

    $_SESSION["wm"]=$rows["wm"];

    echo "<script>window.location.href="../update.php"</script>";
    exit;
}else{
    echo "
       <script>
          window.location.href="../login.php";
           alert("");
        </script>";
}

mysqli_close($con)

?>



create table user

(
    id               int                  auto_increment     primary key,
    name             varchar(30)          unique not null,
    pwd                 varchar(30)          not null,
    wm  varchear(30)     not null
);

the above is the background code and database code. I want to transfer the corresponding screen name (netname) to the main page after successful login verification. How to get this value? ask for advice and help to modify it. Thank you

.
Nov.05,2021

is directly in the location you need to show, and the code is not safe .


   $res = mysql_fetch_array($result,MYSQL_ASSOC);
   $netname = $res["netname"];

you can return a json {"netname": $netname}
accept this json, and add it to the page

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7c1b18-2a8ce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7c1b18-2a8ce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?