Jump to content

[SOLVED] Php Insert MySQL Error


itsureboy

Recommended Posts

OK so i have an upload form on my website connected to the upload.php file.

Everytime i upload i get this error and it doesnt insert into the table:

 

Warning: mysql_insert_id() [function.mysql-insert-id]: A link to the server could not be established in /home/ls/public_html/lauploadcl.php on line 19

 

I dont know whats going wrong....

 

Here is the code:

<?php
$id = mysql_insert_id();
$category = $_POST['category'];
$subcategory = $_POST['subcategory'];
$title = $_POST['title'];
$preview= $_POST['preview'];
$code = $_POST['code'];
$background = $_POST['background'];
$contact = $_POST['contact'];
$extbanner = $_POST['extbanner'];
$extwidth = $_POST['extwidth'];
$extheight = $_POST['extheight'];
$author = $_POST['author'];
$description = $_POST['description'];
$date = $_POST['date'];
$ip = $_POST['ip'];

$dbhost = 'localhost';
$dbuser = 'ex';
$dbpass = 'ex';
$dbname = 'ex';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname)
or die(mysql_error());

mysql_query("INSERT INTO `layouts` VALUES ('$id', '$category', '$subcategory', '$title', '$preview', '$code', '$background', '$contact', '$extbanner', '$extwidth', '$extheight', '$author', '$description', '$date', '$ip')");

include 'closedb.php';
?>

 

Thanks.....

Link to comment
https://forums.phpfreaks.com/topic/66005-solved-php-insert-mysql-error/
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.