[sourcecode language="php"]
<?php
class User
{
private $user_id;
private $username;
private $password;
private $email;
protected static $table_name="lbs_user";
public function __construct($username="",$password="",$email="")
{
$this->username = $username;
$this->password = $password;
$this->email = $email;
}
/* Add a new user.
* Returns true on success, false on error */
public function getUserId()
{
return $this->user_id;
}
public function create()
{
global $gdbObj;
$username = $gdbObj->escape_value($this->username);
$password = $gdbObj->escape_value($this->password);
$email = $gdbObj->escape_value($this->email);
$sql = "INSERT INTO ".self::$table_name." (username,password,email) values('$username','$password','$email')";
if($gdbObj->query($sql))
{
$this->user_id = $gdbObj->insert_id();
return true;
}
else
{
return false;
}
}
/* Update user profile.
* Returns true on success, false on error */
public function update()
{
}
/* Remove an user.
* Returns true on success, false on error */
public function delete()
{
}
}
$guserObj = new User();
?>
[/sourcecode]
Subscribe to:
Post Comments (Atom)
How to enable CORS in Laravel 5
https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...
-
< Requirements Java Development Kit (JDK) NetBeans IDE Apache Axis 2 Apache Tomcat Server Main Topics Setup Development Environ...
-
Download Sourcecode [sourcecode language="csharp"] using System; using System.Collections.Generic; using System.Linq; using System...
Great class. I can see it's easy to add other fields to it as well. However, I noticed the update and delete functions have nothing contained within. Is that done on purpose?
ReplyDelete