SHARE
TWEET

Untitled

a guest Jun 18th, 2019 34 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $username = $_POST['username'];
  2. $password = $_POST['password'];
  3.  
  4. $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username');
  5.  
  6. while($row = mysql_fetch_array($result)) {
  7.     echo $row['FirstName'];
  8. }
  9.      
  10. $result = mysqli_query($mysqli, 'SELECT ...');
  11. // mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given
  12. while( $row=mysqli_fetch_array($result) ) {
  13.     ...
  14.      
  15. $result = $mysqli->query($mysqli, 'SELECT ...');
  16. // Call to a member function fetch_assoc() on a non-object
  17. while( $row=$result->fetch_assoc($result) ) {
  18.     ...
  19.      
  20. $result = $pdo->query('SELECT ...', PDO::FETCH_ASSOC);
  21. // Invalid argument supplied for foreach()
  22. foreach( $result as $row ) {
  23.     ...
  24.      
  25. $stmt = $mysqli->prepare('SELECT ...');
  26. // Call to a member function bind_param() on a non-object
  27. $stmt->bind_param(...);
  28.      
  29. $stmt = $pdo->prepare('SELECT ...');
  30. // Call to a member function bindParam() on a non-object
  31. $stmt->bindParam(...);
  32.      
  33. $username = mysql_real_escape_string($_POST['username']);
  34. $password = $_POST['password'];
  35. $result = mysql_query("SELECT * FROM Users WHERE UserName LIKE '$username'");
  36.  
  37. if($result === FALSE) {
  38.     die(mysql_error()); // TODO: better error handling
  39. }
  40.  
  41. while($row = mysql_fetch_array($result))
  42. {
  43.     echo $row['FirstName'];
  44. }
  45.      
  46. $username = mysqli_real_escape_string($mysqli, $_POST['username']);
  47. $result = mysqli_query($mysqli, "SELECT * FROM Users WHERE UserName LIKE '$username'");
  48.  
  49. // mysqli_query returns false if something went wrong with the query
  50. if($result === FALSE) {
  51.     yourErrorHandler(mysqli_error($mysqli));
  52. }
  53. else {
  54.     // as of php 5.4 mysqli_result implements Traversable, so you can use it with foreach
  55.     foreach( $result as $row ) {
  56.         ...
  57.      
  58. $username = $mysqli->escape_string($_POST['username']);
  59. $result = $mysqli->query("SELECT * FROM Users WHERE UserName LIKE '$username'");
  60.  
  61. if($result === FALSE) {
  62.     yourErrorHandler($mysqli->error); // or $mysqli->error_list
  63. }
  64. else {
  65.     // as of php 5.4 mysqli_result implements Traversable, so you can use it with foreach
  66.     foreach( $result as $row ) {
  67.       ...
  68.      
  69. $stmt = $mysqli->prepare('SELECT * FROM Users WHERE UserName LIKE ?');
  70. if ( !$stmt ) {
  71.     yourErrorHandler($mysqli->error); // or $mysqli->error_list
  72. }
  73. else if ( !$stmt->bind_param('s', $_POST['username']) ) {
  74.     yourErrorHandler($stmt->error); // or $stmt->error_list
  75. }
  76. else if ( !$stmt->execute() ) {
  77.     yourErrorHandler($stmt->error); // or $stmt->error_list
  78. }
  79. else {
  80.     $result = $stmt->get_result();
  81.     // as of php 5.4 mysqli_result implements Traversable, so you can use it with foreach
  82.     foreach( $result as $row ) {
  83.       ...
  84.      
  85. mysql_connect($host, $username, $password) or die("cannot connect");
  86. mysql_select_db($db_name) or die("cannot select DB");
  87.  
  88. $sql = "SELECT * FROM table_name";
  89. $result = mysql_query($sql);
  90.  
  91. if (false === $result) {
  92.     echo mysql_error();
  93. }
  94.      
  95. mysql_query("
  96. SELECT * FROM Users
  97. WHERE UserName
  98. LIKE '".mysql_real_escape_string ($username)."'
  99. ");
  100.      
  101. $username = $_POST['username'];
  102. $password = $_POST['password'];
  103.  
  104. $result = mysql_query("
  105. SELECT * FROM Users
  106. WHERE UserName LIKE '".mysql_real_escape_string($username)."'
  107. ");
  108.  
  109. if($result)
  110. {
  111.     while($row = mysql_fetch_array($result))
  112.     {
  113.         echo $row['FirstName'];
  114.     }
  115. } else {
  116.     echo 'Invalid query: ' . mysql_error() . "n";
  117.     echo 'Whole query: ' . $query;
  118. }
  119.      
  120. $result = mysql_query("SELECT * FROM Users WHERE UserName LIKE '$username'");
  121.      
  122. mysql_select_db('database name ')or DIE('Database name is not available!');
  123.      
  124. $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username');
  125.  
  126. f($result === FALSE) {
  127.     die(mysql_error());
  128.      
  129. $username = $_POST['username'];
  130. $password = $_POST['password'];
  131. $query = "SELECT * FROM Users WHERE UserName LIKE '$username'";
  132. echo $query;
  133. $result = mysql_query($query);
  134.  
  135. if($result === FALSE) {
  136.     die(mysql_error("error message for the user"));
  137. }
  138.  
  139. while($row = mysql_fetch_array($result))
  140. {
  141.     echo $row['FirstName'];
  142. }
  143.      
  144. $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username');
  145.      
  146. $username = $_POST['username'];
  147. $password = $_POST['password'];
  148. $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username');
  149.  
  150. if( $result === FALSE ) {
  151.    trigger_error('Query failed returning error: '. mysql_error(),E_USER_ERROR);
  152. } else {
  153.    while( $row = mysql_fetch_array($result) ) {
  154.       echo $row['username'];
  155.    }
  156. }
  157.      
  158. $result = mysql_query("SELECT * FROM Users WHERE UserName LIKE '%$username%'");
  159. while($row = mysql_fetch_array($result))
  160. {
  161.     echo $row['FirstName'];
  162. }
  163.      
  164. $username = $_POST['username'];
  165. $password = $_POST['password'];
  166. $result = mysql_query("SELECT * FROM Users WHERE UserName LIKE '%$username%'") or die(mysql_error());
  167.  
  168. while($row = mysql_fetch_array($result))
  169. {
  170.     echo $row['FirstName'];
  171. }
  172.      
  173. $query = "SELECT Name,Mobile,Website,Rating FROM grand_table order by 4";
  174.  
  175. while( $data = mysql_fetch_array($query))
  176. {
  177.     echo("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td></tr>");      
  178. }
  179.      
  180. $username = $_POST['username'];
  181. $password = $_POST['password'];
  182.  
  183. $sql = "SELECT * from Users WHERE UserName LIKE '$username'";
  184. $result = mysql_query($sql,$con);
  185.  
  186. while($row = mysql_fetch_array($result))
  187. {
  188.     echo $row['FirstName'];
  189. }
  190.      
  191. $username = $_POST['username'];
  192. $password = $_POST['password'];
  193. $result = mysql_query("SELECT * FROM Users WHERE UserName ='$username'");
  194.  
  195. while($row = mysql_fetch_array($result))
  196. {
  197.     echo $row['FirstName'];
  198. }
  199.      
  200. <?php
  201.     $username = $_POST['username'];
  202.     $password = $_POST['password'];
  203.     $result = mysql_query("SELECT * FROM Users WHERE UserName LIKE '".$username."'");
  204.  
  205.     while($row = mysql_fetch_array($result))
  206.     {
  207.         echo $row['FirstName'];
  208.     }
  209. ?>
  210.      
  211. mysql_query("SELECT * FROM Users WHERE UserName ='".$username."'");
  212.      
  213. $results = mysql_query($connt, "SELECT * FROM users");
  214.      
  215. <?php
  216. $servername = "localhost";
  217. $username = "username";
  218. $password = "password";
  219. $dbname = "myDB";
  220.  
  221. // Create connection
  222. $conn = new mysqli($servername, $username, $password, $dbname);
  223. // Check connection
  224. if ($conn->connect_error) {
  225.     die("Connection failed: " . $conn->connect_error);
  226. }
  227.  
  228. $sql = "SELECT id, firstname, lastname FROM MyGuests";
  229. $result = $conn->query($sql);
  230.  
  231. if ($result->num_rows > 0) {
  232.     // output data of each row
  233.     while($row = $result->fetch_assoc()) {
  234.         // code here
  235.     }
  236. } else {
  237.     echo "0 results";
  238. }
  239. $conn->close();
  240. ?>
  241.      
  242. $username = $_POST['username'];
  243. $password = $_POST['password'];
  244. $result = mysqli_query('SELECT * FROM Users WHERE UserName LIKE $username');
  245.  
  246. if($result){
  247. while($row = mysqli_fetch_array($result))
  248. {
  249.     echo $row['FirstName'];
  250. }
  251. }
  252.      
  253. if (isset($_GET['q1mrks']) && isset($_GET['marks']) && isset($_GET['qt1'])) {
  254.     $Q1mrks = $_GET['q1mrks'];
  255.     $marks = $_GET['marks'];
  256.     $qt1 = $_GET['qt1'];
  257.  
  258.     $qtype_qry = mysql_query("
  259.         SELECT *
  260.         FROM s_questiontypes
  261.         WHERE quetype_id = '$qt1'
  262.     ");
  263.     $row = mysql_fetch_assoc($qtype_qry);
  264.     $qcode = $row['quetype_code'];
  265.  
  266.     $sq_qry = "
  267.         SELECT *
  268.         FROM s_question
  269.         WHERE quetype_code = '$qcode'
  270.         ORDER BY RAND() LIMIT $Q1mrks
  271.     ";
  272.     $sq_qry = mysql_query("
  273.         SELECT *
  274.         FROM s_question
  275.         WHERE quetype_code = '$qcode'
  276.         LIMIT $Q1mrks
  277.     ");
  278.     while ($qrow = mysql_fetch_array($sq_qry)) {
  279.         $qm = $qrow['marks'] . "<br />";
  280.         $total += $qm . "<br />";
  281.     }
  282.     echo $total . "/" . $marks;
  283. }
  284.      
  285. <?php
  286.       $username = $_POST['username'];
  287.        $password = $_POST['password'];
  288.  
  289.      $result = mysql_query("SELECT * FROM Users WHERE UserName LIKE '".mysql_real_escape_string($username)."'")or die(mysql_error());
  290. while($row=mysql_fetch_array($result))
  291.   {
  292.  echo $row['FirstName'];
  293.  }
  294.  ?>
  295.      
  296. error_reporting(E_ALL);
  297. ini_set('display_errors', 1);
  298.      
  299. $sql = "SELECT `foo` FROM `weird_words` WHERE `definition` = ?";
  300. $query = $mysqli->prepare($sql)); // assuming $mysqli is the connection
  301. $query->bind_param('s', $definition);
  302. $query->execute();
  303.      
  304. $sql = "SELECT `foo` FROM `weird_words` WHERE `definition` = ?";
  305. if($query = $mysqli->prepare($sql)) { // assuming $mysqli is the connection
  306.     $query->bind_param('s', $definition);
  307.     $query->execute();
  308.     // any additional code you need would go here.
  309. } else {
  310.     $error = $mysqli->errno . ' ' . $mysqli->error;
  311.     echo $error; // 1054 Unknown column 'foo' in 'field list'
  312. }
  313.      
  314. $username = $_POST['username'];
  315. $password = $_POST['password'];
  316. $result = mysql_query("SELECT * FROM Users WHERE UserName =`$usernam`");
  317.      
  318. $result = mysql_query("SELECT * FROM Users WHERE UserName LIKE '%$username%'");
  319.      
  320. $username = $_POST['username'];
  321. $password = $_POST['password'];
  322. $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username');
  323. if(!$result)
  324. {
  325.      echo "error executing query: "+mysql_error();
  326. }else{
  327.        while($row = mysql_fetch_array($result))
  328.        {
  329.          echo $row['FirstName'];
  330.        }
  331. }
  332.      
  333. if (isset($_GET['q1mrks']) && isset($_GET['marks']) && isset($_GET['qt1'])) {
  334. $Q1mrks = $_GET['q1mrks'];
  335. $marks = $_GET['marks'];
  336. $qt1 = $_GET['qt1'];
  337.  
  338. $qtype_qry = mysql_query("
  339.     SELECT *
  340.     FROM s_questiontypes
  341.     WHERE quetype_id = '$qt1'
  342. ");
  343. $row = mysql_fetch_assoc($qtype_qry);
  344. $qcode = $row['quetype_code'];
  345.  
  346. $sq_qry = "
  347.     SELECT *
  348.     FROM s_question
  349.     WHERE quetype_code = '$qcode'
  350.     ORDER BY RAND() LIMIT $Q1mrks
  351. ";
  352. $sq_qry = mysql_query("
  353.     SELECT *
  354.     FROM s_question
  355.     WHERE quetype_code = '$qcode'
  356.     LIMIT $Q1mrks
  357. ");
  358. while ($qrow = mysql_fetch_array($sq_qry)) {
  359.     $qm = $qrow['marks'] . "<br />";
  360.     $total += $qm . "<br />";
  361. }
  362. echo $total . "/" . $marks;
  363. }
  364.      
  365. include_once(db_connetc.php');
  366.      
  367. // Create a connection
  368. $connection = mysql_connect("localhost", "root", "") or die(mysql_error());
  369.  
  370. //Select database
  371. mysql_select_db("db_name", $connection) or die(mysql_error());
  372.  
  373. $employee_query = "SELECT * FROM employee WHERE `id` ='".$_POST['id']."'";
  374.  
  375. $employee_data = mysql_query($employee_query);
  376.  
  377. if (mysql_num_rows($employee_data) > 0) {
  378.  
  379.     while ($row = mysql_fetch_array($employee_data)){
  380.         echo $row['emp_name'];
  381.     } // end of while loop
  382. } // end of if
  383.      
  384. $username = $_POST['uname'];
  385.  
  386.    $password = $_POST['pass'];
  387.  
  388.   $result = mysql_query('SELECT * FROM userData WHERE UserName LIKE $username');
  389.  
  390. if(!empty($result)){
  391.  
  392.     while($row = mysql_fetch_array($result)){
  393.         echo $row['FirstName'];
  394.      }
  395. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top