Jump to content

[SOLVED] mysql dump, and die


Q695

Recommended Posts

The site I'm using to load data into a database was working fine, now it's dumping data to the browser and dieing, and I don't know why.

 

<?php
if ($catagory && $column_name){
$sql="INSERT INTO categories (
`name` ,
`type` ,
`column_name` ,
'image',
'text'
)
VALUES (
'$catagory', '0', '$column_name', '$image', '$text');";
$result=@mysql_query($sql,$con) or die($sql);
}
?>

Link to comment
Share on other sites

death does both the mysql error, and the sql statement, so I like it better :D

 

It dumps $sql

 

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 ''image', 'text' ) VALUES ( 'Electrical', '0', 'Electrical', 'http://www.qualityc' at line 5

Link to comment
Share on other sites

The whole script is:

<?php
$catagory=$_POST[catagory];
$column_name=$_POST[column_name];
$image=$_POST[image];
$text=$_POST[text];


if ($catagory && $column_name && $image && $text){
$sql="INSERT INTO categories (
`name` ,
`type` ,
`column_name` ,
'image',
'text'
)
VALUES (
'$catagory', '0', '$column_name', '$image', '$text');";
$result=@mysql_query($sql,$con) or die(death($sql));
}
?>

Link to comment
Share on other sites

To some degree it's not picky at all. You don't need the quotes around column names. Actually you don't need them around values either, though for security purposes, it's better to put them around values. But you can leave them off of the column names with no worries.

Link to comment
Share on other sites

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.