Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $stmt_user = $mysqli->prepare("
- #Insert User row
- INSERT INTO
- `USER`
- (
- `name`,
- `contactNumber`,
- `email`,
- `password`,
- `salt`,
- `gender`
- )
- VALUES
- (
- ?,#name
- ?,#contactNumber
- ?,#email
- ?,#password
- ?,#salt
- ?#gender
- )
- ") or trigger_error(mysql_error());
- $stmt_get_user_id = $mysqli->prepare("
- #get id of last inserted user
- SELECT
- `id`
- FROM
- `USER`
- ORDER BY
- `id`
- DESC
- LIMIT
- 1
- ") or trigger_error(mysql_error());
- $stmt_address = $mysqli->prepare("
- #insert Address
- INSERT
- INTO
- `ADDRESS`
- (
- `lineOne`,
- `postcode`
- )
- VALUES
- (
- ?,#lineOne
- ? #postcode
- )
- ") or trigger_error(mysql_error());
- $stmt_get_address_id = $mysqli->prepare("
- #get id of last inserted address
- SELECT
- `id`
- FROM
- `USER`
- ORDER BY
- `id`
- DESC
- LIMIT
- 1
- ") or trigger_error(mysql_error());
- $stmt_user_address = $mysqli->prepare("
- INSERT
- INTO
- `USER_ADDRESS`
- (
- `USER_id`,
- `ADDRESS_id`
- )
- VALUES
- (
- ?,#USER_id
- ? #ADDRESS_id
- )
- ") or trigger_error(mysql_error());
- $stmt_user_group = $mysqli->prepare("
- INSERT
- INTO
- `USER_GROUP`
- (
- `USER_id`,
- `GROUP_id`
- )
- VALUES
- (
- ?,#USER_id
- ? #GROUP_id
- )
- ") or trigger_error(mysql_error());
- $stmt_user->bind_param("ssssss", $name, $contactNumber, $email, $password, $salt, $gender) or trigger_error(mysql_error());
- $stmt_get_user_id->bind_result($USER_id) or trigger_error(mysql_error());
- $stmt_user->execute() or trigger_error(mysql_error());
- $stmt_get_user_id->execute() or trigger_error(mysql_error());
- $stmt_get_user_id->store_result() or trigger_error(mysql_error());
- $stmt_get_user_id->fetch() or trigger_error(mysql_error());
- $stmt_address->bind_param("ss", $lineOne, $postcode) or trigger_error(mysql_error());
- $stmt_address->execute() or trigger_error(mysql_error());
- $stmt_get_address_id->bind_result($ADDRESS_id) or trigger_error(mysql_error());
- $stmt_get_address_id->execute() or trigger_error(mysql_error());
- $stmt_get_address_id->store_result() or trigger_error(mysql_error());
- $stmt_get_address_id->fetch() or trigger_error(mysql_error());
- $stmt_user_address->bind_param("ii", $USER_id, $ADDRESS_id) or trigger_error(mysql_error());
- $stmt_user_address->execute() or trigger_error(mysql_error());
- $stmt_user_group->bind_param("ii", $USER_id, 1) or trigger_error(mysql_error());
- $stmt_user_group->execute() or trigger_error(mysql_error());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement