building basic blog and getting errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
taralee02
Forum Newbie
Posts: 3
Joined: Wed Jul 22, 2009 11:13 am

building basic blog and getting errors

Post by taralee02 »

I went through tutorial on this site...
http://net.tutsplus.com/tutorials/php/h ... ment-83258

It doesn't work for me I get errors.

I get errors…..

Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/a6964267/public_html/Template/SimpleBlog/includes/includes.php on line 20
line 20 is…….
$query = mysqli_query(”SELECT * FROM blog_posts ORDER BY id DESC”);

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /home/a6964267/public_html/Template/SimpleBlog/includes/includes.php on line 24
line 24 isss….
while ($row = mysqli_fetch_assoc($query))

any help or suggestions?

Also another question posted.....link here...
viewtopic.php?f=1&t=103526
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: building basic blog and getting errors

Post by superdezign »

mysqli_query requires a mysqli object as the first parameter. This means that your variable $query will not be a mysqli_result object since mysqli_query() never successfully executes.
taralee02
Forum Newbie
Posts: 3
Joined: Wed Jul 22, 2009 11:13 am

Re: building basic blog and getting errors

Post by taralee02 »

hmmmm ok I am tired now, but I will look at code again tomorrow. Thanks! :-)
Post Reply