Jump to content

Mysql Error


Cooper94

Recommended Posts

<?php if(isset($_POST['add_photo'])){ 
$url = $_POST['url'];


$sql=mysql_query("INSERT INTO photo (url)VALUES('$url')");

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
mysql_close($con);


}
?>

 

I get this error Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/purifi/public_html/nyhalofans.com/add_photo.php on line 42

Error:

 

Thank you in advance for helping me!

Link to comment
https://forums.phpfreaks.com/topic/172547-mysql-error/
Share on other sites

I have fixed the error before but now I am getting this:

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by) VALUES('test','edited','tesss','test')' at line 1

 

With this code:

 

<?php
if (isset($_POST['add_photo'])){

$url = $_POST['url'];
$section = $_POST['section'];
$title = $_POST['title'];

$sql="INSERT INTO photo (url, section, title, by)
VALUES('$url','$section','$title','test')";
if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

}?>

Link to comment
https://forums.phpfreaks.com/topic/172547-mysql-error/#findComment-909591
Share on other sites

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.