Jump to content

not a valid MySQL-Link resource?


theepicgeno

Recommended Posts

<?php
$con=mysqli_connect("blah","blah","blah","blah");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}


if ($_POST['rateup'])
{
mysql_query($con, 'UPDATE pictures SET likes = likes + 1 WHERE likes = 0');
}


$results = mysqli_query($con,"SELECT * FROM pictures ORDER by id DESC") or die(mysqli_error($con));


while($row = mysqli_fetch_array($results))
{
echo "<center><font face='courier new'><u><b>" . $row['title'] . "</b></u><br /></center>";
echo "<center>" . $row['content'] . "<br /></center></font>";


echo "<center><form action= " . $_SERVER['PHP_SELF'] . " method='post' name='rateform'></center>";
echo "<center><input name='rateup' type='image' src='http://www.thevideotube.tk/imgs/thumbup.jpg' id='rateup' value='rateup' /></center>";
echo "<center></form></center>";


echo "<hr style=width:600px />";
}
mysqli_close($con);
?>

Hey! I have a problem... The above code shows every post in the database. Everything works fine except when i click the rateup image, it gives me this error:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in/home/a9004837/public_html/ap/autoPage-new.php on line 11

If anyone can help me, that would be great!

Link to comment
https://forums.phpfreaks.com/topic/281617-not-a-valid-mysql-link-resource/
Share on other sites

Two seconds:

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/a9004837/public_html/ap/autoPage-new.php on line 11

If you're still unsure what I'm getting at, try writing out a list of the functions you're using in this file. Carefully.

If you're still unsure what I'm getting at, try writing out a list of the functions you're using in this file. Carefully.

mysqli_connect
mysqli_connect_errno
mysqli_connect_error
mysql_query
mysqli_query
mysqli_fetch_array
mysqli_close

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.