Linked Questions

0 votes
2 answers
4k views

When I do a SQL search in phpMyAdmin (substituting the variable for the actual value) it returns the correct row number but when using PHP to return this value it always returns 1 no matter what. ...
jayjay's user avatar
  • 59
-1 votes
1 answer
2k views

I'm trying to store the result of COUNT(*) in a variable and use it later for an if statement. Here is my current code: $query = mysqli_query($mysqli, "SELECT COUNT(*) FROM appointment WHERE date = '$...
Adrian Paul Pascua's user avatar
2 votes
2 answers
386 views

I have a table called quote in my database with 5 rows. However when I try to count the rows it always returns 1 instead of 5. I am using the code below: $connection = mysqli_connect("host","username"...
Maz's user avatar
  • 118
0 votes
1 answer
661 views

I've an empty MySQL pets table. When I use the following PHP code, it provides one(1). $query = "SELECT COUNT(*) FROM pets"; $result = mysqli_query($connect,$query); $total=mysqli_num_rows($result); ...
Reza Ansar's user avatar
0 votes
2 answers
82 views

I have verified my query using phpMyAdmin. The count is 130. But my code is giving me a count of 1. $query2 = "SELECT COUNT(*) FROM webvulns"; $result2 = mysqli_query($connection, $query2); ...
Lee's user avatar
  • 17
-2 votes
3 answers
289 views

Is there any mistake in this code ? or my error is somewhere else . $conn = mysqli_connect("localhost","root","root","sajan") or die("Unable to connect to MySQL"); $sql_count = "SELECT count(*) ...
Sajan's user avatar
  • 1,923
0 votes
0 answers
56 views

I wrote a code that is meant to create tables if they are non-existent as a way for it to populate the database on the first launch. Then I came to a part where I started writing the code that is ...
Nyx's user avatar
  • 314
-1 votes
2 answers
64 views

I'm trying to calculate the total number of tokens collected instead of the number of records in the mysql db. Although I have already put the SUM function in the query but it still counts the no. of ...
maddybobby's user avatar
1 vote
3 answers
498 views

I'm trying to implement a pagination system into my website and can't get past this one stubborn error. I'm not exactly sure if you can use FOUND_ROWS() in mysqli as opposed to PDO but that's what I ...
RandomRando's user avatar
0 votes
3 answers
333 views

I have designed a admin login page. The if condition is working but else condition is not. After putting wrong username or password it shows blank on the same page. if(isset($_POST['submit'])) { $...
Nishant's user avatar
  • 69
0 votes
3 answers
100 views

if($sql = $db->query("Count (*) FROM post_items")){ echo mysqli_num_rows($sql); } what's wrong with my code? is this the correct way to echo the total of row in a table?
user3318525's user avatar
-3 votes
1 answer
90 views

I have a select option form in php/html. In the selection option forms I put php like this: <option name="time" value="0900"><?php $a=$r1; echo $a;?></option> Above it I need some ...
Ahmed Imran's user avatar