Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
$query="SELECT MAX(id) FROM articles";
 $result=mysqli_query($link,$query);
 echo $result;


What I have tried:

The $link contains the mysqli_connect code....I have tried everything the mysql query is fine as i tried it on mysql and it worked just fine.
Posted
Updated 21-Jul-20 23:43pm
Comments
Patrice T 22-Jul-20 5:42am    
And the error message is ... ?
Richard MacCutchan 22-Jul-20 7:34am    
Like so many people you do not bother to tell us what the error is. Please, we cannot see your screen, so we have no idea what error messages you are referring to.

1 solution

If the query is fine, then the logical conclusion is that it's the connection object or connection string: use the debugger to see exactly what it contains, and also to look closely at the error message as the content is probably extremely relevant - error messages generally tell you why it was an error, and where. Without that, we can't do anything to help, and we can;t try you code against your database!

So break out the debugger, and start looking at "what" is going on. When you know that, you can start looking at "why" and fixing it - but not before!
 
Share this answer
 
Comments
Richard MacCutchan 22-Jul-20 8:49am    
OriginalGriff 22-Jul-20 8:55am    
Thanks Richard!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900