Error when deleting with PHPMYADMIN

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Zeceer
Forum Contributor
Posts: 136
Joined: Fri Aug 02, 2002 5:10 am
Location: Norway

Error when deleting with PHPMYADMIN

Post by Zeceer »

Hi,

I have a column in a database called products. The column name is info, and it contains the products info. The option for this column is TEXT. What it contains is for an example:

gfjkgjfg
<br>
fdfsdfsdf
<br>
<br>
fsdfsdfsdf

The problem is that when I have new lines in the column, it want be deleted. To delete it i have to smash the whole content together.

Like this:

gfjkgjfg<br>fdfsdfsdf<br><br>fsdfsdfsdf

Then it wil delete. What is this all about? I have to have new lines in the colums since the info comes from a text box. When inputting data to the database I use nl2br() in the info column.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

One thing off the top of my head: use nl2br() when you read from the db, not when you write.

Do post the code you use to write to the DB-table - makes things easier.
User avatar
Zeceer
Forum Contributor
Posts: 136
Joined: Fri Aug 02, 2002 5:10 am
Location: Norway

Post by Zeceer »

Done that. Sounds a little smarter :D . But it still don't fix my "weird" problem :?

The code I use to write to the database:
$query = "INSERT INTO products ( `prodnr` , `category` , `product` , `price` , `info` , `short_info` , `weight` , `image` )
VALUES( '".$_POST['prodnr']."' , '".$_POST['category']."' , '".$_POST['product']."' , '".$_POST['price']."' , '".$_POST['info']."' , '".$_POST['short_info']."' , '".$_POST['weight']."' , '".$_POST['image']."' )";
But I don't think theres anything wrong there, the data is safely added to the database, but I can't delete it. Could it have to do with some settings in the info column?
Post Reply