How to select all articles and their similar articles from MySQL?

MySQL Longtext field retrieval using PHP...?

  • Hello all, I'm fairly new to MySQL and PHP! I have a mysql table called quotes where I'm storing articles and article information. There are 5 fields: Title varchar(255) Link varchar(255) Quote text Abstract text FullText mediumtext I am unable to retrieve any of the FullText. If I use the following code... $query = "SELECT Title, FullText FROM $usertable LIMIT 2"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $FullText = $row["FullText"]; $Title = $row["Title"]; echo "$Title<br>$FullText<br>"; } ...I get this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/b/i/o/bioshieldusa/html/si… on line 63. (Line 63 is the while statement) However, if I replace FullText with Quote or Abstract, everything works and displays just fine. Do I need to use a special method to extract mediumtext from the DB??

  • Answer:

    The word FULLTEXT is a reserved word in MySQL, which is causing problems with your query. You will need to rename this field in order to make your queries work. I once used a field named DESC, it took me ages to figure this out. For a list of reserved words, see this page: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

bigbill at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.