Advertisement
Guest User

Untitled

a guest
Aug 5th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. $servername = "localhost";
  2. $username = "root";
  3. $password = "123456";
  4. $dbname = "school";
  5. $conn = mysqli_connect($servername, $username, $password, $dbname);
  6. mysqli_query($conn, "SET character_set_results=utf8");
  7. mysqli_query($conn, "SET character_set_client=utf8");
  8. mysqli_query($conn, "SET character_set_connection=utf8");
  9.  
  10. if (!$conn)
  11. {
  12. die('error connect' . mysqli_connect_error());
  13. }
  14.  
  15. $db_select = mysqli_select_db($conn,$dbname);
  16. if (!$db_select) {
  17. die('errors select ' . mysqli_connect_error());
  18.  
  19. $room_id = $_REQUEST['room_id'];
  20. $sql = "SELECT * FROM room1 WHERE room_id ='$room_id'";
  21. $result = $conn->query($sql);
  22. $room_id = explode(',',$row['room_id']);
  23. $room_name = explode(',',$row['room_name']);
  24. if ($result->num_rows ==1)
  25. {
  26. while($row = $result->fetch_assoc())
  27. {
  28. if (mysqli_query($conn, $sql)) {
  29. echo "edit comfirm";
  30. } else {
  31. echo "can not edit " . mysqli_error($conn);
  32. }
  33. }
  34. }
  35. mysqli_close($conn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement