Hello everyone,
I am new to MySQL and I am trying to insert the data type TEXT into the database but it isn't working out for me.
I created an SQL file with the following code:
CREATE DATABASE books;
USE books;
CREATE TABLE authors (
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR (255),
info TEXT
);
INSERT INTO authors (name, info) values('Vivek', '
asdfkljasdkl;fjasd
fasdl;kfjaskl;dfjasd
fasdkl;fjasd;lkfjasdf
asdl;fkajsd;lfkjasd;fsd
fkl;asdjfaskl;djfsd
sdakl;jasdl;kfjasdkl;fjasd
asdkl;fjasdl;fkjasl;kfj
');
I created an PHP page with the following code:
<?php
mysql_connect("localhost","root","passwd");
mysql_select_db("books");
$result=mysql_query("SELECT * FROM authors");
$row=mysql_fetch_array($result);
while ($row=mysql_fetch_array($result)) {
echo 'Name: '.$row{'name'}.'<br />';
echo 'Info: '.$row{'info'}.'<br />';
}
?>
Can anyone help me insert and read the TEXT data type the proper way?
Thanks in advance.