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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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).




View Complete Forum Thread with Replies

Related Forum Messages:
How Can I Display Text If A Field In A Table Is Empty?
I want to display some default text in case the data is not yet inserted into two specific rows in my table. So I need to check to see if data exists, and if not, them display some text.

The data being displayed is an MOV file and some comments about that movie. I would also like to not render the box for the movie if that data is missing. Right now, I am using an echo to embed the MOV files, and within the path is the call to the specific file in the table. But if the data is not there, I just get a blank box. Code:

View Replies !
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:

View Replies !
Form - Always Process No Matter If The Text Field Is Empty Or Not
i have this form and i want when the two text fields are empty to stop the process and not to load the php file on the action.... But it always process no matter if the text field is empty or not Code:

View Replies !
Adding Text To Existing DB Field
I have a small database with a few records, each with a 'reviews' field. Is there a realistic way to add something like:

<div class=someclass>
A hundred words or so of text ..
</div>

to the 'reviews' field without disturbing what is already there?

View Replies !
Rich Text Editor Which On Submit Updates The Field To Have The New Text
I have my content stored in a database. I need a rich text editor (so the user doesnt need to include HTML) so they can edit contact. So a rich text editor that displays whats in the current content field and can be edited so on submit it updates the field to have the new text. Get what i mean?

View Replies !
Adding Text To Text Window With A Button
I have made an admin section of a site, What i want to do i have buttons under that have "BOLD" "center" and when clicked it adds <b></b> tags to the text area etc etc..

if the text area was called "message"

how would i going about coding the images / buttons to add the code?

View Replies !
Adding Text To A Search Box By Clicking On The Text
I'm trying to create a series of hyperlinked strings such that when the user clicks on the hyperlinked string, the text automatically goes into a search box and all the user has to do is to press a button to execute the search.

I am expecting this to be easy, but I have no idea how to link the two parts up.

My expection is that this involves making the search box dynamic. But of all the tutorials I've read, you can create an initial value for the statement within the search box by simply using the "value" command, but I've not seen a way to manipulate that value statement on the go.

View Replies !
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.

View Replies !
Mysql Field: Text
Is there a reason why I should choose a varchar over a text type on a field that is intended to store, let's say an url? It seems that both have variable size so that won't make a difference.

View Replies !
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.

View Replies !
Use Htmlentities When Inserting Text Into A 'text' Field
Should I use htmlentities when inserting text into a 'text' field or should I leave the input and htmlentities the output when displaying?

Pound signs etc work, but having issues with & (&amp;) and trying to strip_tag at the same time?

View Replies !
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?

View Replies !
Query Text Field From Mysql
I have the following code in one of my php files to pull from mysql database:
$result = mysql_query("SELECT DATE_FORMAT(date, '%m-%d-%y') AS formattedDate , track, horse, price FROM claimers where track_code =1 ORDER BY date DESC");

It works fine, when the database field is an integer. The problem I'm having is when the database field is a CHAR field. I don't know how to use the where clause?

View Replies !
HTML In Mysql Text Field
I am build a news portal website run on php and mysql. I have a description field where i might need to place html tags such as links to websites and i might need to place php in there aswell. The field is a TEXT field.

Will i have any problems such as inserting special characters "<,/:;"'[{" and so on. If so how do i bypass this problem.

View Replies !
TEXT Datatype Field Of MySql
I make a user registration form. I saved this data in table of mysql. Here is one field description in table this is of Text type. It stores details about company. Now problem is that user enter data in description field with formatting means using newline charaters [line feed, tab] but when i retrive data from table it shows Description field data in a single line with no formatting.

View Replies !
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.


View Replies !
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.

View Replies !
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 ....

View Replies !
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 Replies !
Gaining Access To How MySql Parses Text For Full Text
I want to gain access to the function or process MySql uses to parse words and phrases for Full Text searching. Here is an example.

If the user inputs...

Milan in history

MySql will search for milan, history, and milan history. Is there a way to extract just the combination of terms MySql uses to search the db without the stop words? Stop words are automatically eliminated from the search request unless the user encloses a phrase in quotes.

What I am trying to do is develop a script to highlight found search terms and phrases. I can explode a phrase into single words but if I do that the stop words would be included in the array. If there is some way of getting into the parsed words or phrases MySql Full Text actually uses to search, I can use each of those combinations as a keyword in my highlighting script.

This request is about searching for the code or any code related to the questions involved.

View Replies !
Display Some Text To The Screen Via A Link To The Text In A Mysql Db.
I am just screwing around a little and trying to display some text to the screen via a link to the text in a mysql db.

View Replies !
How Do I Check Wheter A Text Box Is Empty Or Not ?
how do i check wheter a text box is empty or not ?

View Replies !
Adding Text
I'm trying add a copyright message to photographs I upload using convert. I'm having trouble with the syntax or quotes. Please help or have ideas?

exec("$magic/convert -font Arial -fill White -pointsize 10 -gravity SouthEast -draw 'text 10,10 © Copyright Mike Dantignac Photography' $full/$filename $full/$filename");

View Replies !
Adding Alt Text?
I use C Panel for my mySql database and have currently got 4 fields that i use.

Wallpaper ID
Wallpaper name
Large Image
Small Image

Id like to add some alt text to be used for both sizes of images, how do i go about doing this?

View Replies !
Adding Image Next To Text
I read and understood the tutorial for "Quick and dirty PHP/MySQL" publishing system. However after trying hard to find a way to add an imageurl next to the text, it just seem to be impossible. It only shows the url next to the written stuff, so I am looking for a string/code which converts the URL to show the image.

I have also tried using a BBcode string in the script but it didn't work either. I know it's a simple thing but it has kept me up for 5 days now.

View Replies !
Adding Text To Variable
I have an email login screen that sends the username and password to
an authentication screen. I designate the username with the name of
the input, i.e. <input type="text" name="username"> with 'user'
entered sends $username=user to the php authentication page. The
problem is, to log in, users have to enter 'user+domain.com' in the
user name (ISP requirement). Is there a php script I can add to the
login page so that a user can just type their user name and the code
will automatically add '+domain.com' to the end of it and send it as
$username=user+domain.com?

View Replies !
Adding Text To Images
i want to add the text to my images.here is my code but it is adding the text to only first image(horses.jpg) and displaying that image. this is my code.i want to add www.abc.com on both images. Code:

View Replies !
Adding Text On Images
i want to add the text to my images.here is my code but it is adding the text to only first image(horses.jpg) and displaying that image.

this is my code.i want to add www.abc.com on both images. any of your idea will be appreciated.please find where iam wrong. Code:

View Replies !
Adding Into A Text Input
How would i go about making something so when its clicked it gets added into the text field? For example if i have a bunch of letters i could click them and they would appear in the text field. Therefore you could type out words and things without using a keyboard. Id like it real time so im not sure if id need to have it made using AJAX. So yeah thats it really, you just add words into a input text field by clicking things. If i have to make the clickable things images thats fine. I just need to make it so i can put things into a text field on a form.


View Replies !
Adding Text To A Textarea
I'm not too sure if this is going to be php or javascript. I think probably a bit of both. I'm making a sort of cms system and have a text area where news is added. I want to add links into the text area to other areas of the site, but the links are something like this "events.php?cmd=view&id=#". So its going to be far too difficult to rememeber the link to each page. I can create a list of the events from the database but need make them selectable so that when they are clicked "<a href="events.php?cmd=view&id=#">event title</a> is added the text box.

View Replies !
Replace Empty MySQL Field Variable
I have the following MySQL query:

$usermood = mysql_query("SELECT * FROM `user_info` WHERE `user` = '$c[user]'");
while($row=mysql_fetch_array($usermood))

if (empty($usermood)) {

$mood = blank;

} else {

$mood = $row['mood'];
}

The query works, but my problem is in the "if/else" statement... What I wanted to do is to replace the variable $mood with the word "blank" if there's no data in the "mood" field. The "$mood = $row['mood'];" works fine and I'm able to display an image using the variable, but my problem is when there's nothing in the field, I get a broken link image.

View Replies !
Adding Letters On A Text Variable
I have the var $test which has the value test, i tried to add ing at the end by using PHP Code:

View Replies !
Adding Text To Textarea With A Button
A while ago i posted a note on here asking how i could do this. Code:

View Replies !
Adding Spaces To A Text String
i want to do and im not sure how to go about it if i had a text string returned that was a long post of just characters no spaces included that displayed would break the width of my html frame causing scrolling and its a hassle i dont particually want.

so how can i go about looking for spaces and adding them if the character length is long with no spaces included?

View Replies !
Adding Numbers From A Text Document
I've tried, and searched and lost sleep over this one and I've nearly admitted defeat. I have a text document with certain details listed which comes from another document which comes from a series of forms. The document, let's say 'test.txt', has numerical values at lines 5, 11,17, 23 and so on so forth (just add 6 to the last number and you get the next).

Each month the numbers in the file will be added together to give a total. Now there could be only a few numerical entries into the file, or there could be a hundred entries. How can I add the numbers from test.txt lines 5, 11, 17, 23, 29 etc etc together to make a total without having to do the "$lines[5], 1, 4 " + $lines[11], 1, 4" etc etc.

View Replies !
Text In A Field
I was just wondering how. When you see an input box and it allready has writing in it. eg "Write your comment here." when you click on the input box the text disappears, then if you havent typed anything in and you click away, that text appears again.

View Replies !
Adding +1 To Mysql Field
Is it possible to add +1 to a current value been stored in a int field in a mysql table.

View Replies !
Mysql - Adding A Field?
How do i add a field into my table once it's been made and the table has rows in...

View Replies !
Update Statement Causes Mysql Varchar Field To Be Set To Empty String
I have come across a problem that has me baffled.

I am using PHP with MySQL 4.1.14. Whenever I execute an update
statement against a specific table, some of the varchar fields do not
get set to the new values, but get set to empty strings instead.

I have simplified the code down to updating a single column in the
table, but the same results happen when updating just the single
column.

Here is the stripped down code which causes the problem:

$queryString = "UPDATE REGISTRATION SET passwd = '$pass'' WHERE id =
388";
$db = mysql_connect("hostname", "user", "pass");
mysql_select_db("CUSTOMER", $db) or die(mysql_error());
mysql_query($queryString, $db) or die(mysql_error());

Printing the query string after executing mysql_query shows the
following query:

UPDATE REGISTRATION SET passwd = 'test' WHERE id = 388

This query updates the column successfully when run directly through
phpMyAdmin. When run through PHP using the code above then column is
set to an empty string value.

There is no error returned if I call mysql_error() nor is there any
unusual info returned from mysql_info() (other than it telling me that
1 row was affected).

Does anyone have any ideas what the underlying problem is on this one?
Could be an attribute of the database table or columns that would cause
this behavior? I have racked my brain for a while over this problem.

View Replies !
Adding Newline Characters When Writing To Text File
I have a simple variable record length text file. For each record I entered manually to get started, they have a /cr and /n after line. I used notepad to create my file. I now have a PHP/HTML script which I want to be able to add, modify and delete records. I am currently working on the modify. I am using the fgets, ftell, fseek and fwrite to manage the file. When I write my record to the file and open it up in notepad, it doesn't create a new line. It appends it to the current line. Do I need to specify how many characters to write out in the fwrite? How can I insert the carriage return and newline characters so notepad will recognize them?

View Replies !
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.

View Replies !
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:

View Replies !
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.

View Replies !
Show Value For Text Field
the text field is PHP Code:

<input name="page[]" type="text" size="3" maxlength="3" value="<?php echo $row_some['PAGE']; ?>" />

it show the same value at the first value in the database.

in the database.

page
34
43
56
34
45
65


but in my coding,it will show value 34 in each of text field value.

View Replies !
Convert Text Field
I need to convert the charset of all the text fields in my db to utf-8. Can I do it via SQL alone or do I need some server side programming? A link to some article will suffice, altough I wouldn't mind a complete answer.

View Replies !
Multipurpose Text Field?
I'm trying to figure out the best way to do this, but I'm running into some problems.

I have a form that contains checkboxes. One of the checkbox options is Other: and then a text field. The checkboxes are created by a query to my dbtable "Colors_Menu": Code:

View Replies !
Displaying Field In Text Box
I have this code:

<?php
$result = mysql_query("SELECT title FROM optionaltext WHERE id= 1");
  
$row = mysql_fetch_array($result);
$titletoedit = $row['title'];
//to test value
echo $titletoedit;
?>
  Title: <input name="title" type="text" value=<?php echo $titletoedit; ?> size="50" maxlength="30"/>
  <br/><br/>

The variable $titletoedit gets the field which has some text data in which is 'Optional Text 1', when using echo it shows 'Optional Text 1', but when i try to display it in the textbox it just says 'Optional'.

View Replies !
Text Area Field
I can't get the form value of this textarea field below to display when updating a form.

$cellvalue = "";
if ((!isset($_GET["cf2"])) && (!isset($_POST["cf2"]))) {
$itemvalue = $row[2];
} else {
$itemvalue = qsrequest("cf2");
}
$cellvalue = "<textarea class="ta" name="cf2" value="" . qsreplace_html_quote(stripslashes($itemvalue)) . "" ></textarea>";
if ($cellvalue == "") {
$cellvalue = "&nbsp;";
}
echo "<td>" . $cellvalue . "</td>"

View Replies !
Loop With Text Field
I have a loop which generates some text fields which the user then inputs a single number and submits the form. The problem is that when you try to enter the number into the text field, it seems not to respond on PC's.

<?php
// Selected Modules Script
function listStuff() {echo "<span class='style1'>Modules Selected: </span>";
for($i = 0; $i < count($_POST)-1; $i++) {
if((!strstr(current($_POST), "YardBoss")) and (!strstr(current($_POST), "CombiSystem")) and (!strstr(current($_POST), "Suburbs")) and (!strstr(current($_POST), "Vouchers"))) {
echo "<br />".current($_POST); ?>
<input name="option<?php echo $i; ?>" type="hidden" id="option<?php echo $i; ?>" value="<?php echo current($_POST); ?>">
<input name="order<?php echo $i; ?>" type="text" id="order<?php echo $i; ?>" size="5" maxlength="1">
<?
next($_POST);
}
}

View Replies !
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.

View Replies !
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?

View Replies !
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:

View Replies !

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