<?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!