Guest User

Untitled

a guest
Oct 26th, 2016
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2.     $pubname = $_POST["pname"];
  3.    
  4.     $servername ="localhost";
  5.     $username="root";
  6.     $password="jit123";
  7.     $dbname="1jt14cs007db4";
  8.  
  9.     $conn= new mysqli($servername,$username,$password,$dbname);
  10.  
  11.     if($conn->connect_error)
  12.     {
  13.         die("CONN failed :" . $conn->connect_error);
  14.     }
  15.     else
  16.     {
  17.         //echo "Before Update"
  18.         $sqlquery="select * from publisher where name='".$pubname."';";
  19.         $result = $conn->query($sqlquery);
  20.         if($result->num_rows>0)
  21.         {
  22.             echo "<table align=\"center\"border=1> <tr> <th> Publisher ID </th> <th>Name</th><th>City</th><th>Country</th></tr>";
  23.             while($row=$result->fetch_assoc())
  24.             {
  25.            
  26.                 echo "<tr><td>$row[publisherid]</td><td>$row[name]</td><td>$row[city]</td><td>$row[country]</td></tr>";
  27.            
  28.             }
  29.             echo "</table>";
  30.         }
  31.         else echo "empty set";
  32.        
  33.        
  34.         //$updateQuery = "update catalog set price=price+price*0.1 where publisherid in(select publisherid from publisher where name=‘".$pubname."‘);"     
  35.        
  36.     }
  37.    
  38.  
  39.     $conn->close();
  40. ?>
Add Comment
Please, Sign In to add comment