Advertisement
hmrneves

Untitled

Feb 28th, 2015
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2.     function get_ra($input)
  3.     {
  4.         $servername = "localhost";
  5.         $username = "root";
  6.         $password = "x";
  7.         $dbname = "gestao_trabalhos";
  8.        
  9.         // Create connection
  10.         $conn = mysqli_connect($servername, $username, $password, $dbname);
  11.         mysqli_set_charset($conn, "utf8"); // mysqli extension
  12.    
  13.         //variaveis com queries à db
  14.         $sqlx = "SELECT ra FROM trabalhos WHERE id='$input'";
  15.         $x = mysqli_query($conn, $sqlx);
  16.         $x = $x->fetch_object()->ra;
  17.         echo "<a href='".$x."'>Link</a>";
  18.         $conn->close();
  19.     }
  20.     return ;
  21.    
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement