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




How To Make Text Wrap In Table Cells?


I don't understand this at all. I have a table with fixed width and height in pixels. Yet when I place a long text string in a cell, the cell expands as far as needed to the right or left to fit the string on one line. This is driving me quite mad. How do I ensure that a long string is displayed in a neat, orderly fashion? My question has nothing to go with wrapping text around images. I just simply need to have text wrapped!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Limit # Table Cells
I'm trying to write a script that would allow me to limit the amount of table cells and the # of rows in the table. PHP Code:

Wrap Text Around Image?
I have a table with a dynamic image and dynamic text field. Whatever i
try, the text doesn't wrap around the image. Can someone please help me
out with this?

this is the code:

<td>
<img src="fotos/<?php echo $row_Recordset1['foto']; ?>" alt=""
name="fotoholder" width="200" height="200">
<?php echo nl2br( htmlspecialchars( $row_Recordset1['tekst'])); ?>
</td>

Wrap Image Text GDLIB
has anyone successfully wrapped text in a image generated on the fly?  If so can you let me know how.

Empty HTML Table Cells Have No Borders, What Do You Do?
When I first start using databases and dynamic content, I noticed that when you use table borders in your designs and if the database column/row doesn't have any info the html table outputed looks funny. I was wondering how you handle this.

I use a function that puts a clear gif image.

Code:
//This function is used for replacing an empty var with a clear gif 1px X 1px
function replace_empty($vars) {
if ($vars =="") {
$vars = "<img src='images/clear.gif' width=&#391;' height=&#391;' alt=''>";
}
echo $vars;
} //End function replace_empty

Or you could use some CSS like "empty-cells: show"

Print Table Cells To Fill In The End Of A Calendar
I have a variable called $rowCount that keeps track of how many total cells have been added to a table. Its actually the month view of a calendar. I need to print blank cells representing the days of the next month to fill in the cells and make the grid complete. I am almost there, I just need to figure out how to make it stop printing new cells when the $rowCount variable becomes divisible by 7. That would mean that all table rows have 7 columns, and the grid is complete. here is what I tried so far, but this just keeps printing the cells, never stopping. PHP Code:

Extract Html Table Cells And Put To An Array
i have a table like:

<tr><td>headA</td><td>headB</td><td>headC</td><td>headD</td></tr>
<tr><td>1a</td><td>1b</td><td>1c</td><td>1d</td></tr>
<tr><td>2a</td><td>2b</td><td>2c</td><td>2d</td></tr>
<tr><td>3a</td><td>3b</td><td>3c</td><td>3d</td></tr>
<tr><td>4a</td><td>4b</td><td>4c</td><td>4d</td></tr>

where there can be any number of rows and there can be any number of columns.

how can i read through this and create an array for each row, and use the header row as the keys.

ie have it something like:

QuotemyArray[0] = array(
     'headA' = '1a',
     'headB' = '1b',
     'headC' = '1c',
     'headD' = '1c',
);
     
myArray[1] = array(
     'headA' = '2a',
     'headB' = '2b',
     'headC' = '2c',
     'headD' = '2c',
);

etc....

Make Table Appear On Top
i made a php with just a table and included all the material with php include http://www.hbksite.com/index2.php but here is the problem when i got to it the menu appears in the middle is there any way to make it be always on top please help here is the code:

Make A Table In MySQL
How do I make a PHP script that is able to make tables with fields? I want to be able to have a HTML form submit the fields. I just want to know the PHP scriptlet that will make a table.

Using Foreach To Make A Table From Db Info
what im trying to do is make a table of all the info from a database that i have im trying to use the foreach function, im not sure if this will work or the most efficent way.

Automatically Make Text Into A Link
how do I make php search through a $_POST[variable] for a certain set of string, lets say R1000000.  Then I would want to turn that string (R1000000) into a link
<a href=example.php?id="R1000000">R1000000</a>Then append that link back into the original $_POST[variable] replacing the R1000000, with the link version. I'm sure this is doable, I just have no idea where to start, regex?

Make Link To Typed Text
Is there some possibility in PHP to do automatic link when somebody type URL in form window? (One or more URL in one text.)

example: www.xxxxxxxx.com to be a <a href="http://www.xxxxxxxx.com">www.xxxxxxxx.com</a>

(as I think, maybe I can do that with chage string when query returned from database, but I must to know how he typed in database in text: only "www..." or begin with "http://www...".) Is somebody have a script how can I change strings?

Code To Make Table Rows Of A Result Appear In Alternating Colours...
How can I get it so that when I run a search, and the results come back in table format, the rows are alternating colours, like on Devshed's forums? I believe there was some code here some time ago saying how to do it..

How To Make Text Area Recognize Hyperlinks?
I built a simple form where a user can enter and post news items to his
site (with PHP, into MySQL). He doesn't know much HTML.

Is there some way he can enter some simple text to declare something a
hyperlink, and have PHP recognize that that means "make this text into a
hyperlink"?

....so that instead of having to type this into the textarea:

<a href="http://www.somesite.com">somesite</a>

....he could type something more intuitive, like this:

<somesite.com>somesite</somesite.com>?

How Can I Find A Name From One Table In A Text From Another Table?
I have one table with a description field and other info, and I also have another table with a list of names and picture url:s. When I display the text description on my site I'd like to know if there are a match with a name from the 'names' table in the text. Code:

PHP And CGI-WRAP
I am designing a php based website for a local college here in Vegas. The sucky thing is that they use cgi-wrap in order to protect the rest of their server from possible damaging scripts. Here is an excerpt from their directions:

In order to allow users to write/install cgi scripts, CGIWRAP has been installed on the UNLV Web Server (URL). CGIWRAP protects the web server by running the cgi script as the owner of the script (thus limiting any damage done by the script to that account).

If you are setting up a PHP script, please note that PHP works much the same as Perl on the UNLV Web Server. In order for your script to work, you must observe the following guidelines:

1. The first line of your script must look like this:

#!/usr/local/bin/php

2. Your script must be placed in the cgi-bin directory.

3. The file permissions must be set to executable.

To see your script in action on the Web, use the following URL:

Now I've done all of this. For example I have a php script called 'index_header.php' that I is in my cgi-bin. From there in my index.html I include the file as follows:
<!--#include="http://www.unlv.edu/cgiwrap/shtfilm/index_header.php" -->
But this is what I get:
URL

Any help or directions? I have not had any problems dealing with php pages until I've had to deal with cgi-wrap.

How Do You Make The Contents Of A Text Box Remain, Even After Clicking Send, With Errors ?
How do you make the contents of a text box remain, even after clicking send, with errors?

At the moment, the visitor inputs a load of text into the comments box, but if they click send and there's errors in other fields on the page, the comments box goes blank and they have to start all over again ...

Make Text String Read From Right To Left In Imagettftext() Function
I want to write a text string from right to left instead of from left to right with the imagettftext (); function

I read in teh manual that the angle variable controls this, it says that 0 angle means left to right, so I tried 180, 360 but nothing happens

What angle do I need to put it to get it to write it right to left

I am writing a hebrew text string with a font.ttf that supports hebrew characters

<?php   
$white = imagecolorallocate($background, 255, 255, 255);
$fontfile = "davidtr.ttf";
$string = "&#1502;&#1495;&#1500;&#1491;&#1490;&#1499;";
imagettftext($background, 12, 360, 3, 17, $white, $fontfile, $string);
?>

Formatting Excel Cells
Is it possible to format the cells of excel spreadsheet using php. I download a excel spreadsheet from webpage which is passed thro the headers. I want to format the cells in this manner using php. This is the code in VB. Code:

Range("A1:K1").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 15
Selection.Font.ColorIndex = 9
With Selection.Interior
.ColorIndex = 48
.Pattern = xlSolid
End With

Php Word Wrap Function Needed - One That Works
I have been looking for a php word wrap function. I know there's an
official PHP function but I've tried that and many of the functions
contributed on that php.net page and none do what I want...and some act
weird as well.

I want, If I say break at 150 chars then the function will break at the
nearest space to 150 ie. it will actually break at the word boundry. And
if theres a url it will not break inside a URL, it will leave URLS alone.

Export MySQL To Certain Excel Cells
I have  .xls files that I want to be able to export MySQL data into.  Is there a straightforward way to do this...I'll really only be inputing 2-3 values.

So pretend I have:

$test1
$test2
$test3

And I want to export them into test.xls in cells  A1, A2, A3.  Can someone provide the method for doing this?

Forcing Word Wrap/ordering Of Draws From Mysql
A: how do i force when i pull data to a table the text to wrap? and B: how do i control order of how it is displayed when it draws from the DB? (ie 07/25/00 11:45pm showing up at the top then 07/25/00 9:45am showing up after that)what i have right now: Code:

Create A Table Regarding A Text File
I have this .txt file :

Roger|tow25$rank259
Isabelle|tow36$rank24
Pascal|tow12$rank29
Sergeï|tow45$rank5
Michel|tow1245$rank45478
Frédéric|tow1$rank125425

And this programm php3
<?php
$fichier = "classeur.txt";
if($fp = fopen($fichier,"r")){
$ligne=1;
echo "<table border=1 bordercolor="#00CCFF" width=500>
";
echo "<tr align=center><td colspan=3>TITRE</td>";
while (!feof($fp)) {
list( $name, $tampon ) = explode( "|tow", $fp );
list( $tow, $obj ) = explode ( "$rank", $tampon );
echo " <tr>";
echo "<td
align=center><b>Nom".$name."</b></td><td>Tow".$tow."</td><td>Obj".$obj."</td[color=blue]
>";[/color]
echo "</tr>
";
$ligne++;
echo "</table>
";
echo "$cell";
fclose($fp);
}else{
echo "Error : open impossible ".$fichier;
exit();
}
?>

I would like to past each value of the lines in the tex file, in 3 variables
$nom; $tow; $obj
and create a table with 3 column ( column 1 the name, in 2 the tow, and in 3
the obj)

Populating Table With Text File
My web hosting service uses phpMyAdmin and at the bottom of the screen
iis an area where I can upload a text file to populate a table.

I have a table named groups with two fields:
groups_idauto-increment primary
groups_name

So how do I create my text file to populate this table?

I'm going to use MS Notepad.

If it's set to auto-increment, do I need to include the number? If
so, does it start at 0 (zero)?

Would the file look like:

0,students
1,faculty
2, staff

or just

students
faculty
staff



Problem In Handling Long Text In MYSQL Table
i am making a database driven website which is working fine.
My web page contains lot of text and it is very diffcult to upadate its content from the text_field of MQSQL table. As i have to read each line again and again to update it.

I have alloted parent_id to each category_id in my database table and thus retreving results from it...

I want to know what should i do to handle this long text ...such as if i am able to make a seperate text file for each of my html_body variable and somehow include that file to a webpage when i select a particular parent_id from my wepage.

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.

How To Populate HTML Table From Local Text File.
I am looking for a way to populate an HTML table from an external
local text file which looks like this:

DATE/TIME LAT. LON. DEPTH. ML.
-------------------- ---------- ---------- ------- -------
21/03/2005-04:06:03 XX,XX XX,XX 171 3,42
21/03/2005-12:23:53 XX,XX XX,XX 500 5,4
21/03/2005-12:43:10 XX,XX XX,XX 553 5,38
21/03/2005-18:47:51 XX,XX XX,XX 162 3,91
21/03/2005-19:29:49 XX,XX XX,XX 500 3,51
21/03/2005-20:04:51 XX,XX X,X 75 3,72

The file could have more rows (DATA) that I show here. The file is
provided to me on a daily basis and I have to update a web page daily
with the contents of the file.

I considered using JavaScript embedded in the HTML page but I am a
newbie on what scripting for the web it refers.

How can I populate the HTML table with this text file which changes
everyday.

Also, is it possible to use php client-side only, without a server?

Explode Text Area Into Array For MySQL Table
On my site, I have a textarea where users enter their sites' information in the following format (tab-delimited):

Site Name <tab> Site Description <tab> URL <newline>
Site Name <tab> Site Description <tab> URL <newline>
(and so on...)

I know I have to use the "Explode function and a loop to get the data into an array and enter it into a MySQL table. Would anyone have a snippet of code off-hand that could show me how to do this?

Creating Temporary Table From Full-text Query
i'm using a full-text search on my db which works fine, but now i'm working on filtering the results further, like products in range of prices. my logic is to simply SELECT them out of the temporary table, only if it would be created. i don't think i need to paste any code since i think you get the idea.

Select From Drop List To Fill Table Column With Text -- HOW ?
I want viewers to compare state laws on a single subject.

Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the column below.
The viewer can select states from the drop down lists above the other two
columns as well. If the viewer selects only one, only one column fills. If
the viewer selects two states, two columns fill. Etc.

I could, if appropriate, have a separate htm page with the text for each
state -- california.htm for example. When the viewer selects California from
the drop down list, the column below would "fill" with California.htm.

Or, I could conceivably use a text or mysql database with two fields for
each record: state_name and law_text -- but it would probably be easier to
use separate htm files, since there will only be about 20 states involved,
and the "database" would never have a large number of records.

The table width would be 100% and each cell would be @33%

My site is designed with FP 2002 and runs on Apache/FreeBSD. I have just had
Apache-ASP installed but I have not yet configured or used the module.

Table Based Order Form That Can Email Text Entered?
I have a custom order form that I collaborated on with a friend who knows php.

The form needs updated and the code we put together is hard for me to read and update. I think the form can be refined or rewritten in a more OOP way and hopefully as sematic as possible.

The Form is for entering ready made frames. The Choices are color and size. Here is what I need to do:

Enter Name, Email, Store Number, Comments Etc.Create a table based form where users can only enter numbers in each text field.Upon completion, agreement, and submission of the order an html email is kicked to our inbox. The table remains as it was on the website due to html and a separate print css file. Code:

No Libphp4.so File Created In Make Intstall Or Make.
I have done a make, and a make install on the 4.3.6 version, using
/usr/local/etc/php as the directory I make from. However, no matter what
I do, I do not see a php4lib.so that has been created. The documentation
I recieved (an IBM source) says that the following has to be added to the
httpd.conf file :

LoadModule php4_modulelib/apache/libphp4.so
..
..
..
AddModule mod_php4.c

here is the output from my make install :

[root@mail php]# make install
Installing PHP SAPI module: cgi
Installing PHP CGI into: /usr/local/bin/
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Archive_Tar - already installed: 1.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.3.1
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
[PEAR] DB - already installed: 1.6.2
[PEAR] HTTP - already installed: 1.2.2
[PEAR] Mail - already installed: 1.1.3
[PEAR] Net_SMTP - already installed: 1.2.3
[PEAR] Net_Socket - already installed: 1.0.1
[PEAR] XML_Parser - already installed: 1.0.1
[PEAR] XML_RPC - already installed: 1.1.0
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
program: phpextdist

Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?

Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for.  Can anyone help me get the Agreed? table's background color to the colors above? Code:

Outputting A Table Or Form Using SHOW FIELDS FROM Table
In the code the MySQL database was queried using "SHOW FIELDS FROM table" which and the returned results of column names was then use to build an output for a form and a table with php using a series of if statements along the lines of if the returned field name matches something echo a text input field.

I have never seen this done this way before, so I want to get the opinion of the devshed user. Does it seem like an unsual long process to build up a form. Is there a security advantage doing it this way? Has anyone ever done it this way before?

Finding Matches In A Table And Then Moving That Match To Another Table?
Ok, I have a database that has a table called critiera in this table
is to fields on is ID and the other is critiera.

Now I want to filter out all the one that don't apple to the list and
move the one that match to a different database.

I know how to open a connection, close, select

but I don't know how I would inside of a database use another one as
the way to create the list of critieras....

Mysql Fetch_field Gets Table Alias, Not Real Table Name
After a SQL 'select .... from tablename alias'
the mysql_fetch_field function returns a value $result=>table which
will contain the alias, not the actual table name.
Is there a way to get the actual table name ?

I am running mysql 4.1 and php 4.4

Grab Data From A Table, Echo, Then Insert It Into A New Table...
I'm trying to do is count the number of times usernames shows up in a table. I then want to reinsert that information into a different table with the Username in column1 & the occurrences in column2 for every user that is echoed on the page. Code:

Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'.

There is one of each item in products and each product has it's own unique 'prodno'

There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example:

id = 1
prodid = 7001
qty = 300
price = 12.5

id = 2
prodid = 7001
qty = 400
price = 15.5

I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table.

Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item..

This is all very confusing to me, and I'm the one writing it. Let's try one last time..

Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.

Update Table While Insert Data To Another Table
it seem like mine coding din work.
[php]<?

include("checkin.html");
$conn=mysql_connect('localhost','root','') or die ('Could not connect to server');
$today = date("Y.m.d");
mysql_select_db('hms', $conn);

$ok = mysql_query("INSERT INTO check_in(ID,room_no,datein)values ('$ID','$room','$today')", $conn);

if( $ok ){

$up = mysql_query("UPDATE studtable SET checked = 'checkin' where [ID] = '%ID');

if(mysql_affected_rows( $up ) == 1)
{
echo'Checked IN!'
}else { echo'No such student to check in' }}
else { echo'Check In FAILED, please check again'}?>[php]

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

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.

How To Transfer A Data With An Id To Another Table From A Table?
how am i going to transfer let say a name identified using the suer id and copy the name to the other table having the same user id>?

Returning Table Name As Well As Fields From That Table
I am returning all fields from news and from regional, however I want to determine where the fields have come from when I ouput the data, therefore I need to return the table name with the fields. Is this possible? Code:

Moving Data From One Table To Another Table
Does anyone know how to move one row from a table in a mysql database to another table using php?

Text Area Not Accepting Large Amounts Of Text
I have a form where teachers enter homework assignments and they are then stored in a MYSQL database and retrieved elsewhere.

I have been using "get" with the form. The code is simple:

<textarea name="array[assignment]" cols="60" rows="10" id="array[assignment]"></textarea>

It does allow post of 100 words, etc. Stuff that teachers normally submit.

What's happening is that it won't allow very large posts (over 300 words maybe? ) Not sure what the cut off is. When you press submit it won't go, or there is an error where it won't submit.

Is there a limit for text fields? Since the fields scroll, I didn't think that having only 60 rows was any type of real limit, I though you could put in as much as needed. But then all of it ends up in the address bar, so there must be a limit of some sort.

Imagettftext() Gives Grainy Text When Writing Aliased Text
I'm using a bundled version of GD: 2.0.23 compatible. When using the
function imagettftext() with a negative color to get a aliased text,
the text gets grainy. What could be wrong? I've tried several ttf
fonts, with the same result.

Read And Display Japanese Text From Text File
I posted a question regarding reading japanese
text from a text file.

Well, since I solved the problem, I thought I'd post my solution for
the benefit of other people with the same problem.

The plan was to make a script to read and display japanese text. I
will use it for making a japanese proverb script and for a japanese
language study script.

Method :

I wrote a simple kanji text file (saved with UTF-8 encoding)
I wrote a simple PHP script to display the file contents (saved with
UTF-8
encoding)
I specified the content-type header for the HTML page :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

*** All files have the same encoding. ***

UTF-8 supports japanese characters.

and it works!

this is my PHP (and HTML) script :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHP : Japanese Text File Read : Exercise 1</title>
</head>
<body>

<?php

$filename="japanese.txt";
//open file
$fp = fopen($filename,'r');

//loop through each line in the file
while($line=fgets($fp))
{
//output current text file line
print $line."<br>";
}
//close file handle
fclose($fp);

?>

</body>
</html>

I know it's a very simple script, for testing purposes only. It
displays the contents of the japanese text file line by line.

The key was to save all files in the same encoding (I used UTF-8) and
to specify the encoding / charset in the HTML header (<meta
http-equiv="Content-Type" content="text/html; charset=utf-8">)

Append Text At End Of Existing Text On Same Line
I'm working on a part of my web site that uploads images, then writes the name of the image to a text file. The upload part works fine. The part that writes the name of the image to the text file works fine.

What I'm trying to do is, after all the files have been uploaded and all of the image names have been written to the WriteTo.txt file, append a written description of the picture at the end of the picture name. In other words, after a user uploads their pictures to the server I want to direct them to a page where they can label each of the pictures using a form. PHP Code:

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?


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