Hello, I have had this error for a long time and tried everything that I know to fix that, but unfortunately I was unsuccessful.
Error:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/XXX/public_html/xxx/profile.php on line 800
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/xxx/profile.php on line 801
I am doing a pagination in profile.php for my website. This is the PHP code I have for it.
<?php
$query ="SELECT * FROM x1 ORDER BY x2 ASC LIMIT 7";
$result = mysqli_query($sql,$query);
while($row=mysqli_fetch_array($result,MYSQLI_ASSOC))
{
$msg_id=$row['id'];
$message=$row['x2'];
?>
<?php
if(isset($_POST['lastmsg']) &&is_numeric($_POST['lastmsg']))
{
$lastmsg=$_POST['lastmsg'];
$query="SELECT * FROM x1 where id>'$lastmsg' order by x2 asc limit 7";
$result = mysqli_query($sql,$query);
while($row=mysqli_fetch_array($result,MYSQLI_ASSOC))
{
$msg_id=$row['id'];
$message=$row['x2'];
?>
BTW. I have a code that connects to database on the same page.