Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Book Script ,should I Use Txt File Or Mysql Text Field ?


I am doing simply book script, where we will have hundred of books,user will be able to read chapter by chapter or search etc.. As u know that book contain will have html tages..etc.. and each book is around 200 kB....My php script read text file and display. It's a huge text file.

I am thinking to use database instead of text file. But text files are very huge. My question, should i use database instead of text file ? which one is faster and better.

I have noticed, when i copy 150 kB files and paste into phpmyadin, it gives me internel error..but it insert record. I used txt field for book contain.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Quickly Adding Text To A Mysql Text Field That Is NOT Empty
Is there a way to insert text into a mysql text field that already has
text into it; without having first to extract the existing data and
append the new text to that string variable and then insert the new
string.

Basically i'm looking for a way to do it with a single query not 2 (one
being a select to gather existing data).

Mysql Text Field
I have a DB with a column that is set as Text format. The data stored in the field will be stored in many lines. When I get the data from the DB I want it to display where the line breaks are I'm not sure how to write the script to do this. I have worked withe explode before but there is nothing come at the end of each line to do this with.

Text Field As Date (MySQL)
I have a generic table used for many different generic
functions. the fields are mainly varchar's but one of these varchars
contains dates (in the format dd/mm/yyyy) for one reason or another.

My question is, can I perform a query on this table, using date
functions on this varchar field? I.e. search for the latest date?

How To Sort A Flat Text File By A Particular Field
I have created a flat file database to store contact information on my friends. The fields are 'firstname', 'surname', 'job title', 'address' etc What I am trying to do is be able to display a sorted list of my friends based on a particular field eg 'sort by surname'or 'sort by address' etc

Each row in the file ends with a '' and each field in each row is separated by a ' '.

I have come to the conclusion that I need to use the array_multisort function but cannot find any examples of taking information from a flatfile database and using array_multisort to sort and display based on a particular field. This is how far I have got but I am now stuck as to where to go from here? I have read the php manuals but it does not appear to improve my understanding of what needs to be done. Code:

Displaying First 50 Characters Of A Mysql Text Field?
I have been searching for hours on the php website for a function that
will allow me to display just the first 50 chars of a mysql text field
in a results table, but i'm having no luck. I need it to create a
results page for a site i'm creating in php.


Display MySQL Data In Text Field
I have my site set up and am now working on the admin side. I have a page that lets me search my users then its linked to another page so I can edit the information.

I am attempting to get the code to display in my forms text boxes and text areas for updating. My problem is that I can't figure out how to get the data into my form for editing. I have a few different things but can't seem to figure this out.

Error When Inserting A ' Into Mysql Text Field
I'm using the below code to insert some text fields from a form into a database. I've noticed that if we type something using a ' (i.e we're all going out for the day) in the text field then we get a insert error back from mysql saying it can't insert into the text field. I kind of think I know what the problrem is but need someone in the know to clear it up for me ....

How To Retrieve An Xml File From An Xml Field Found In Mysql Database?
Infact i have a mysql database in which i have field name xml in which all the metadata are stored in xml files.

Best Book PHP/MySQL
What's the Book Certification Study Guide to PHP and MySQL?

What Is The Best Book On MySql?
What is the best book to read about MySql?

Text Returned From DB Gets Cutoff When Placed In A Text Field
I have a string that contains an apostrophe or a quotation mark, stored in a DB. I can retrieve the data, and display it properly (for editing) in a textarea, but when I try to put the string in a text field, it get's cut off right before the questionable character.

For example:
$string_in_database = "John's car."

 -displays correctly here <textarea><?php print $string_in_database ?></textarea> and displays this - John's car.

 -gets cutoff here <input type='text' value=''<?php print $string_in_database ?>' /> and displays this -  John

I've tried adding slashes and stripping slashes and I just can't figure out what I need to do.

CSV File-based Address Book Code Snippet?
Since I'm a PHP newbie and the only address book apps I found
through Google require MySQL or PostgreSQL, I figured I'd ask if
someone has come code handy.

I'd just like to keep a list of addresses in a CSV file (ie. columns
last name, first name, e-mail, office #, etc.) so as to ease backing
up, and read/update this list from a PHP script.

I guess it's pretty much just a loop to read + parse, and a form to
update, but if someone has the code handy, I'm interested :-)

Export Mysql To Text File Via PHP
I need help on how to export one of table mysql to text file to download. (not saving text into server)
something with like header("Content-type: text/plain");

Importing Csv Text File Into MySQL
I have a CSV file delimited by ~. Here is an example of 3 records: Code:

Importing Text File Into MySQL DB
I'm writing a script to import a text file with fields delimited by ~ into a MySQL DB. I'm trying to import everything into an array first, so that one array row = one record row. Here is some dummy data, with the &#390170;' record having a couple of new lines where a new paragraph is. Note the other records have NULL in the same field: PHP Code:

Reading From Text File And Storing In MySQL
I have a text file consist of 10 digit phone numbers one number per line like this:

5553332244
5553332244
5553332244
5553332244

etc…

How do I read a text file line by line and populate the data into an array to store it into a MySQL database? My database is below:

Read The Contents Of A Text File Into MySql Using PHP
New to this, have the basics, can build a form and such. My problem is I
need to be able to open a file on a pc/s on the network, read the data
character by character, check to see if a certain character is present, if
it is, update the database and continue reading the file until it comes
across the character again, updates the database and so on . . . .

Uploading Info From A Text File Into A MySQL Database
what would the PHP and SQL code be to say basically: make a new row and put this in the field, what comes after each comma goes in a new field, and each new line should be a new row.

I have a huge text file that i don't have a way to upload directly into a MySQL database because my webhost isn't allowing it for some reason.

Using Php To Move Rows From Text File Into Mysql Table
Can anyone point me in the right direction for the way to read a text file a
line at a time and separate the fields on that line and use them as data in
an INSERT to add a record to a mysql table. Then read the second line in
text file and repeat.

Site Stats, Php/mysql OR Flat Text File?
I'm have a cms  and I want site stats built in, thus apache's stats or cpanel etc don't cut it for multiple users.

I have a working stat query below, the problem is, in a short time 12 hours, it's grown to 109k with 500 records.
now I'm not adding a row for every person, I create a session, and if they already have a row, I update clicks (page clicks) as you can see.

still, it's big, the bots are eating it, so I figure, why not just create a separate table for bots, with 1 row per day and a click count. there, smaller. but with multiple users, and lots of normal hits, this will still grow quite large very fast!

so I'm wondering if flat text files would be a better solution? but perhaps opening and writing to a text file constantly gets very slow? I'm confused. Code:

MYSQL Query Script To Reading From A Text File
Im having a hard time converting the following tree menu script to read nodes from a text file, rather then a database.  This script works perfectly and is exactly what i am looking for, however it relies on query's from a MySQL database (I don't know how to set one up is the real problem).  I would like to keep the feature where you can pass a parameter through the script and its expands the corresponding folder. Code:

Select Both Field Name And Field Value- Mysql ?
What function to use to select both field name and field value from a mysql table ?

Validate Text Field
This is very simple in javascript but I can't seem to find the exact solution in php. I have searched the forum but couldn't find my exact example.

I have "page1.php" with a <form> that includes one text field and a submit button. Once submitted the data in the text field would be entered into the DB. I want to make sure that before the <form> is submitted that there has been some data entered into the text field. I have seen the function --- empty() and I have also seen if (!$textfieldName)
all coupled with <? PHP_SELF ?> in the action field of the <form> but it just doesn't seem to work for me.

I think that it doesn't work because the page that I am entering data in the text field is also inserting data to the DB from a previous page and the <? PHP_SELF ?> is conflicting with this----(Just speculating).....I don't know I am kinda stumped.

Text Field Variable
I'm new trying to use php forms.  Trying to write what is typed into the text field to a file.  But its not working.  It makes the file, but the text field data is not written. Code:

How To Query In A Text Field
can i query in a text field, i have the normal fulltext search but i want to or substr search it or something, but i dont know how.

Validating TEXT Field Entires
Because I have several TEXT fields in my MySQL database, I need to know how to validate that only alphanumeric characters have been entered -- as this data will be echoed back to the user upon completion of the form.

Therefore, I need to prevent any malicious text from being entered into the form (SSIs, HTML formatting, etc.)

Is there any way to do this?

So far, I've only been referred to addslashes(). I've managed to use the following function:

function validate_text($text) {
$text = addslashes($text);
return ($text); }
$input_text = validate_text($input text);

But this only escapes single and double quotes with the slash. URLs, SSI statements, etc. remain untouched.

TEXT Or BLOB Field Problems
When I use a form and php to input long articles (in a TEXT field) into a mysql table, the code runs smoothly (i get a thank you message). However, the record isnt always put into the table.

If I input only the varchar fields into the form, then it works. But if I also try to append the TEXT field then it doesn't work from a web form. It works sometimes but not all fo the time.

Why does this only work sometimes, do i have to do something witht he code? change the database?

Form Text Field Validation
I've got a form and I'm now trying to validate the text fields in it. The field I want to validate is for someones name, so there should only contain letters. Below is the function I've written to handle this. Code:

How To Find A Match In A Text Field ?
i am using ereg($rowvalue[0],'humor2')==true to find a match in the text field. how can i find a exact match, ie. the text field contains 'humor,humor2'

so, if using ereg the result will be true for both humor and humor2 but only 1 - humor2 is correct. how do i find an exact match ?

Increment A Text Field In A Form
I am creating an intranet which shows active projects and allows people to add new projects. If users want to add a new project, they fill in a form but what I want the form to display in the ProjectNumber field (which is a var char field & not the primarykey) is the last Job Number incremented by 1.

For example if the last ProjectNumber was TS0014, then the default value in the ProjectNumber field should be TS0015 - this way users know what the next job number is.
At present, the last job number in my table is TS0014. Below is the code i'm using but for some reason in the Job Number field in the form Im getting TS001? WHY? Code:

Form Field Text Output
How can I get html code in an editable form field to display properly? Specifically: I have text that is echoed to a form field via <? echo $text ?>

The user can then edit that text and submit. However <BR> is showing up as a literal <BR> and should be a linefeed. Is there a way to have this display properly?

Example: LINE ONE<BR>LINE TWO
should display as
LINE ONE
LINE TWO

Note that this is only a problem in the form field. It displays properly when echoed outside of the form.

How To Get Un-escaped Text From A Form Field
I have a php script that gets the text from a form field:

<?php

include("global.inc.php");

pt_register( 'POST', 'test1');
echo $test1;

?>

The text comes back fine, just some characters (', " and ) are now escaped
(', " and ). The problem is that I need the he text to be exactly as it
was entered by the user. I could process the text myself, and replace the
escaped characters, but I'd like first to understand why this is happening
and if there is a way to disable this behavior and get the unmodified text
directly.

Text Field, Dates And Insert
The user types a date (dd-mm-YYYY) in to a text field, the date is checked against a regex and if it passes, is then inserted to a database.

For some reason inserting the date ($this->input->post('date')) directly in to the database gives the default for the field (0000-00-00). I've tried doing date("d-m-Y", $this->input->post('date')) but get 1970-01-01 or something like that. Do you have any advise for converting the text field input in to a format that can be inserted in to the database?

Removing URL Link From Text Field
How can i remove a URL link from a form text field or the area where results are posted when a user enters http://www.mywhateversite.com. For example, here on this site.

I want to allow the text, but not the link. If you guys are familiar with myspace and have tried to put a link to another site, the myspace site automatically changes it to something else or blank. Thus allowing the user to post the site url, but without the link.

PHP Will Not Read More Than 4096 From My Microsoft Sql Text Field.
I have a textarea that is saving to a mssql text (very large) field. The insert, update is working fine. However, when php reads the data using mssql_result function, I'm getting limited to 4096 characters read by php. I know that there are at least 6000 characters and I can see them using microsoft's query analyzer. This is not a magic quotes, single quote, quote, html entity or anthing like that. PHP will not read more than 4096 from my microsoft sql text field. Any ideas how I can get php to read more?

Is It Possible To Modify Part Of A Text Field Output?
I am made a simple web site search function. I use MySql 4 and have a table that contains all text on a web site in a column type text.

I can search it, but I want to make the search term bold when I print out the text field content. PHP Code:

Text Field Eats Up Multiple Words!!??
I pass a variable in my url which is let's say two words separated by a space.
now if i just echo($variable) then i get both the words as they are.. separated by a space... but on the other hand if i put that same variable inside a text field.. i.e <input type=text name=bla value=$variable> i get only the first word of the variable

e.g.
$variable = "hello there";

displayed normaly i get:
hello there

displayed inside a text field i get:
hello

i tried using different things like urldecode/urlencode/rawurl blabla/ the best i could get to display was a hello+there
so is there any solution to displaying $variable as it is inside a text field.. by the way it displayed fine if i use a textarea but i need to use a normal text type input.

Inserting A Row Of Characters In Text Field Automatically
Good Day to All! Hoping someone can help with this simple problem. I am inserting text into a text field. Because there may be a number of entries made sequentially I want to automatically insert a line of characters such as ****** or ------------- automatically between rows to make the output more legible. Here is what I have so far. I want to insert the line after ....

Displaying Information From A Database In A Text Field,
I am trying to create an admin page, but before I get anywhere near that, I need to understand how to get data froma database to show up in appropriate form fields *text, textarea, etc...*

I am able to get content from my database to show up in my template, now I want to create a page that allows a user to click on a link for which they want to edit the information (name, and bio) So I want that page to show up with a simple form, a text field displaying the name, and a textarea displaying the bio information, so that they can modify it and save it to the database. how do you get the information to show up in the form fields? Code:

Passing PHP Variable Into An Html Text Field
I am working on a flatfile configuration program and I need to read a single record csv file into php and pre-load the values into html text boxes. I have the file reading part working with 6 variables $field1 through $field6. When I am done, I then save the form back to the same file. This allows a configuration file to be updated from the web.

How To Check For Blank Spaces In A Text Field???
does anybody know how to check for blank spaces?  I dont just mean blank, blank but actual spacebar spaces. ive tried is_null and !isset and neither one works??

Help On A Multiple Keyword Search On A TEXT Field Type
Working on a php/mysql driven site which requires me to have a search facility based on multiple keywords. I read the tutorial "quick and dirty search engine". What i want to know is :

1. Is there any SQL query i could perform which could to almost the same thing ( i dont really need the accuracy ) ?

2. Any other methods of achieving it?

Is There A Php Command To Take A Specific Field From A Delimited Line Of Text?
I have a string which is multiple fields delimited by commas.

I would like a php command that says... take the 3rd field for
example.

ie. If MYVARIABLE has the data "hello,there,big,world".

I would like to be able to say, pickup the 3rd field "big" without
knowing the character positions or lengths.

Removing/stripping Unwanted String In A Text Field
I have an abstract field that contains some rtf codes..now I want to strip all those rtf format so I can display it in my page cleanly..how can I accomplish this?. Code:

Formatting The Contents Of A Text Area Form Field
On my site I get users to enter a load of information in a textarea
box, however when i save this data to my mysql DB and then retrieve it,
it comes out without all the formatting, like new paragraphs and new
lines.

Can anyone tell me how you can capture the data entered into such a
field with all the formatting the user has entered like new paragraphs
etc?

Bold/Italic/Underline Buttons For Text Field.
How would I go about making buttons (much like the ones above where you type posts/replies on this or any other message board) that would insert HTML code for:<b>, <i>, <u> etc, wherever the user's cursor is at within the text field?...Is that even PHP? Or another web technology all together?

Disable Submit Button If Text Field Is Empty
I am unsure if this must be done with Ajax, or if it can be done with PHP. I have a simple search page where I want the submit button to be disabled if there is nothing entered in the text field, and once something IS entered, then the search button is enabled.

I was thinking Ajax, because I am looking for it to be real time and I am not sure if its possible with PHP as I am just a novice when it comes to certain things. So the button is always disabled when there is nothing, and enabled when the user enters something.

And lets say the user enters something and removes it, then the button disables again? Is this possible to do with PHP and if so, could someone please help me tackle this . Code:

Clearing The Input Text Field After Submiting The Form To A New Page
I have a page with a form with an input text field ... and when a user types his/hers ID ... and submits the form - his/hers page opens in a NEW window .... but the value (ID) that was written in the original window remains.

I want to make sure that the form input field on the original page becomes "invisible" - by refreshing/reloading the original page or just by clearing the input form after submission.

For now I have put in a meta refresh tag in the head of the html file ... but that is not the solution ... becouse I only need a one time refresh/reload of the page ... and this is to happen right after the input text value is being submitted.

Displaying File Path In File Input Field
i have file input field in a form like this:
<input name="isbn" type="text" size="25" value="<?php echo
$_POST['isbn'] ?>" />
<input name="image" type="file" size="25" value="<?php echo
$_FILES['image']['name'] ?>" />

when i press "submit" button, the same page gets loaded... if my
$_POST['isbn'] is empty, i want to have the file path on "file input
field" to redisplay on that same field... it's possible in text input
field but i don't know of a way to do it in file input fields...


Copyright © 2005-08 www.BigResource.com, All rights reserved