Horje

Tips (Total 3)


# Tips-1) How to exclude a specific row from mysqli select record

USE  WHERE `mapa`='1' and id <> '3'

How to stop displaying a record from mysqli row id

Use following Example. and use according to your codes.

index.php
Example: PHP
$sql="SELECT * from plugin WHERE cat = '$catid'  and id <> '$id' order by id ASC LIMIT 30";

# Tips-2) How to exlude empty value from selecting mysqli row

Skip the empty value from mysqli selects query.

Use: name != ''

 

Database

id name country
1 Dhaka Bangladesh
2    
3 London England

Result:

1. Dhaka

2. London

Here skips 2 number rows which was empty

How to skip Empty Value from selecting mysqli

See the example.

index.php
Example: MYSQLI
$sql = "SELECT * FROM data WHERE name != '' ORDER BY id asc LIMIT 10";

Output should be:

How to skip Empty Value from selecting mysqli

# Tips-3) How to Check if exist in database mysqli_num_rows

you are not running the sql statement by using mysqli_query

you must first query sql statement and then count row.

Method - 1

See the example.

index.php
Example: PHP
<?php

$conn = mysqli_connect("127.0.0.1", "my_user", "my_password", "my_db");
/*mysqli connection*/

$check = mysqli_real_escape_string($link, $_REQUEST['email']);
    $sql = "SELECT * FROM users WHERE email = '$check'";
    $res = mysqli_query($conn,$sql);
      if (mysqli_num_rows($res ) == 0){
          echo 'Number of Row 0';
    } else {
        echo 'Row available';
    }
?>