We help IT Professionals succeed at work.
Get Started

Connection Error

158 Views
Last Modified: 2020-01-12
Can you please tell me how to i fix that error?  Thanks.

SOMETHING IS WRONG HERE: function mysqli_fetch_all($result, MYSQLI_ASSOC)
Warning: mysqli_connect(): (28000/1045): Access denied for user 'HarrisK'@'ip-107-180-46-230.ip.secureserver.net' (using password: YES) in /home/hfll4ovlkhjz/public_html/config/db_connect.php on line 3
Connection error: Access denied for user 'HarrisK'@'ip-107-180-46-230.ip.secureserver.net' (using password: YES)
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/hfll4ovlkhjz/public_html/index.php on line 6

Fatal error: Uncaught Error: Call to undefined function mysqli_fetch_all() in /home/hfll4ovlkhjz/public_html/index.php:8 Stack trace: #0 {main} thrown in /home/hfll4ovlkhjz/public_html/index.php on line 8

Open in new window


<?php
	include('config/db_connect.php');
	// write query for all pizzas
	$sql = 'SELECT title, ingredients, id FROM pizzas ORDER BY created_at';
	// get the result set (set of rows)
	$result = mysqli_query($conn, $sql);
	// fetch the resulting rows as an array
	$pizzas = mysqli_fetch_all($result, MYSQLI_ASSOC);
	// free the $result from memory (good practise)
	mysqli_free_result($result);
	// close connection
	mysqli_close($conn);
?>

<!DOCTYPE html>
<html>
	
	<?php include('templates/header.php'); ?>

	<h4 class="center grey-text">Pizzas!</h4>

	<div class="container">
		<div class="row">

			<?php foreach($pizzas as $pizza): ?>

				<div class="col s6 m4">
					<div class="card z-depth-0">
						<img src="img/pizza.svg"class="pizza">
						<div class="card-content center">
							<h6><?php echo htmlspecialchars($pizza['title']); ?></h6>
							<ul class="grey-text">
								<?php foreach(explode(',', $pizza['ingredients']) as $ing): ?>
									<li><?php echo htmlspecialchars($ing); ?></li>
								<?php endforeach; ?>
							</ul>
						</div>
						<div class="card-action right-align">
							<a class="brand-text" href="details.php?id=<?php echo $pizza['id'] ?>">more info</a>
						</div>
					</div>
				</div>

			<?php endforeach; ?>

		</div>
	</div>

	<?php include('templates/footer.php'); ?>

</html>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2020
Most Valuable Expert 2018
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE