Skip to main content
se añadieron 67 caracteres en el cuerpo; título editado
Origen Enlace
lois6b
  • 7.6k
  • 5
  • 33
  • 54

"Trying to get property of non-object in" Error al verificar registro

Mi problema es al verificar si hay un registro en la base de datos

$category_id = $_POST["category_id"]; 
    $name = $_POST["name"];
    $lastname = $_POST["lastname"];
    $address = $_POST["address"];
    $email = $_POST["email"];
    $phone = $_POST["phone"];
    $created_at = date('Y-m-d');

    $veri = "SELECT count(*) FROM medic WHERE name = '$name' ";
    $result = $db->select($veri); 
    $row = $result->fetch_row();
    $user_count = $row[0];
    if($user_count>0) {echo "1";}
    else {
        $query = "INSERT INTO medic (name, lastname, email, address, phone, created_at, category_id) VALUES  ('$name',
                     '$lastname',
                     '$email',
                     '$address',
                     '$phone',
                     '$created_at',
                     '$category_id')";
        $r = $db->select($query);
        echo "Datos Insertado";
    }

No tengo ni idea de lo que puee estar fallandoMe da el fallo:

"Trying to get property of non-object in" No tengo ni idea de lo que puede estar fallando

"Trying to get property of non-object in" Error al verificar registro

Mi problema es al verificar si hay un registro en la base de datos

$category_id = $_POST["category_id"]; 
    $name = $_POST["name"];
    $lastname = $_POST["lastname"];
    $address = $_POST["address"];
    $email = $_POST["email"];
    $phone = $_POST["phone"];
    $created_at = date('Y-m-d');

    $veri = "SELECT count(*) FROM medic WHERE name = '$name' ";
    $result = $db->select($veri); 
    $row = $result->fetch_row();
    $user_count = $row[0];
    if($user_count>0) {echo "1";}
    else {
        $query = "INSERT INTO medic (name, lastname, email, address, phone, created_at, category_id) VALUES  ('$name',
                     '$lastname',
                     '$email',
                     '$address',
                     '$phone',
                     '$created_at',
                     '$category_id')";
        $r = $db->select($query);
        echo "Datos Insertado";
    }

No tengo ni idea de lo que puee estar fallando

Error al verificar registro

Mi problema es al verificar si hay un registro en la base de datos

$category_id = $_POST["category_id"]; 
    $name = $_POST["name"];
    $lastname = $_POST["lastname"];
    $address = $_POST["address"];
    $email = $_POST["email"];
    $phone = $_POST["phone"];
    $created_at = date('Y-m-d');

    $veri = "SELECT count(*) FROM medic WHERE name = '$name' ";
    $result = $db->select($veri); 
    $row = $result->fetch_row();
    $user_count = $row[0];
    if($user_count>0) {echo "1";}
    else {
        $query = "INSERT INTO medic (name, lastname, email, address, phone, created_at, category_id) VALUES  ('$name',
                     '$lastname',
                     '$email',
                     '$address',
                     '$phone',
                     '$created_at',
                     '$category_id')";
        $r = $db->select($query);
        echo "Datos Insertado";
    }

Me da el fallo:

"Trying to get property of non-object in" No tengo ni idea de lo que puede estar fallando

Origen Enlace

"Trying to get property of non-object in" Error al verificar registro

Mi problema es al verificar si hay un registro en la base de datos

$category_id = $_POST["category_id"]; 
    $name = $_POST["name"];
    $lastname = $_POST["lastname"];
    $address = $_POST["address"];
    $email = $_POST["email"];
    $phone = $_POST["phone"];
    $created_at = date('Y-m-d');

    $veri = "SELECT count(*) FROM medic WHERE name = '$name' ";
    $result = $db->select($veri); 
    $row = $result->fetch_row();
    $user_count = $row[0];
    if($user_count>0) {echo "1";}
    else {
        $query = "INSERT INTO medic (name, lastname, email, address, phone, created_at, category_id) VALUES  ('$name',
                     '$lastname',
                     '$email',
                     '$address',
                     '$phone',
                     '$created_at',
                     '$category_id')";
        $r = $db->select($query);
        echo "Datos Insertado";
    }

No tengo ni idea de lo que puee estar fallando