Jump to content


Photo

Help with database query


  • Please log in to reply
5 replies to this topic

#1 99naa

99naa
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 01 October 2006 - 07:15 AM

Hi

I have inserted a text file into a database field.  When I executed the following query I get absolutly no result in the web page.  The code is....
<?php
  //connect to the database
  include ("connect.php");
  echo "<tr><td width='846' height='651' valign='top'><div align='center'><br>";
  //get the about us file from the database
  $query = "select * from aboutus where aboutus ='$aboutus[$i]'";
  $result = mysql_query($query) or die ("error");
  //display the query results in a table
  while ($row = mysql_fetch_array($result));
  {
    echo stripslashes($row['aboutus']);
  }
  mysql_close();
?>

the text file is called aboutus.txt, the table is called aboutus and the field is called aboutus.

If anyone can put me onto the right track I would really appreciate it.

Many thanks

99 ;)

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 01 October 2006 - 01:20 PM

I have inserted a text file into a database field.


I assume you mean you have inserted the contents of a text file ...

Where in your code does the value of $aboutus[$i] get set?
Legend has it that reading the manual never killed anyone.
My site

#3 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 01 October 2006 - 04:22 PM

Ho whave you stored the text file? Whats the data type you used?




Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#4 99naa

99naa
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 02 October 2006 - 02:25 AM

Well The problem I think is that the content of the text file is not sitting in the database properly.  I have no idea where its being set.

The file is stored as a .txt file.  In the database the field data type is longblob

I am a very raw beginner at this and of course jumping in the deep end. 

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 October 2006 - 11:28 AM

Does the database field named aboutus actually contain any data? If so, what? 
Legend has it that reading the manual never killed anyone.
My site

#6 99naa

99naa
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 02 October 2006 - 09:25 PM

yes, as far as I am certain, the field does contain data, when I do a query to show what is in that field I get 10 rows retuned.  The field is containing text regarding the company, what they are about.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users