theepicgeno Posted August 27, 2013 Share Posted August 27, 2013 <?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! Quote Link to comment Share on other sites More sharing options...
requinix Posted August 27, 2013 Share Posted August 27, 2013 (edited) 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 11If 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 August 27, 2013 by requinix Quote Link to comment Share on other sites More sharing options...
theepicgeno Posted August 28, 2013 Author Share Posted August 28, 2013 Two seconds: 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. Sorry, I don't understand. Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted August 28, 2013 Solution Share Posted August 28, 2013 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 Quote Link to comment Share on other sites More sharing options...
theepicgeno Posted August 28, 2013 Author Share Posted August 28, 2013 (edited) mysqli_connect mysqli_connect_errno mysqli_connect_error mysql_query mysqli_query mysqli_fetch_array mysqli_close .__. As you can see I am new with this stuff. I found it. Edited August 28, 2013 by theepicgeno Quote Link to comment Share on other sites More sharing options...
requinix Posted August 28, 2013 Share Posted August 28, 2013 Just have to pay attention to little things. The error told you where the error was so your first step should be to look at the line very carefully and see if there aren't any little mistakes like that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.