Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Can any one help me to convert this php to jsp?

    PHP Code:
    <?php $conn = @mysql_connect('127.0.0.1','root','root'); if (!$conn) { die('Could not connect: ' mysql_error()); } mysql_select_db('mydb'$conn); ?>
    PHP Code:
    <?php $page = isset($_POST['page']) ? intval($_POST['page']) : 1$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10$offset = ($page-1)*$rows$result = array(); include 'conn.php'$rs mysql_query("select count(*) from users"); $row mysql_fetch_row($rs); $result["total"] = $row[0]; $rs mysql_query("select * from users limit $offset,$rows"); $items = array(); while($row mysql_fetch_object($rs)){ array_push($items$row); } $result["rows"] = $items; echo json_encode($result); ?>
    PHP Code:
    <?php $id intval($_REQUEST['id']); include 'conn.php'$sql "delete from users where id=$id"$result = @mysql_query($sql); if ($result){ echo json_encode(array('success'=>true)); } else { echo json_encode(array('msg'=>'Some errors occured.')); } ?>
    PHP Code:
    <?php $firstname $_REQUEST['firstname']; $lastname $_REQUEST['lastname']; $phone $_REQUEST['phone']; $email $_REQUEST['email']; include 'conn.php'$sql "insert into users(firstname,lastname,phone,email) values('$firstname','$lastname','$phone','$email')"$result = @mysql_query($sql); if ($result){ echo json_encode(array('success'=>true)); } else { echo json_encode(array('msg'=>'Some errors occured.')); } ?>
    PHP Code:
    <?php $id intval($_REQUEST['id']); $firstname $_REQUEST['firstname']; $lastname $_REQUEST['lastname']; $phone $_REQUEST['phone']; $email $_REQUEST['email']; include 'conn.php'$sql "update users set firstname='$firstname',lastname='$lastname',phone='$phone',email='$email' where id=$id"$result = @mysql_query($sql); if ($result){ echo json_encode(array('success'=>true)); } else { echo json_encode(array('msg'=>'Some errors occured.')); } ?>

  • #2
    New Coder
    Join Date
    Aug 2014
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Like PHP, a JSP or Java Server Page file creates a website from the server, allowing more complicated functions than a basic HTML page. PHP and JSP files are text-based, so if your server generates a PHP file that should be displayed as a JSP, switching it over is easy. The browser displays a webpage based on the extension, so even if the code would be best displayed in JSP form, if the extension is PHP the browser displays it that way

  • #3
    New Coder
    Join Date
    Sep 2014
    Posts
    41
    Thanks
    0
    Thanked 1 Time in 1 Post
    i think, its not easy.you can ask any experts to convert this one


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •