Jump to content

not a valid MySQL-Link resource?


Go to solution Solved by requinix,

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. Edited by requinix
  • Solution

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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.