Re: Table in MySql database



I noticed that Message-ID:
<daoe9j$70g$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> from Margaret
contained the following:

>I have a PHP script written by my Nephew (now in the USA working in a
>summer camp so unavailable) which gets information from a database. I
>can add all the stuff I need to the database and in the "longtext" field
>can add html tags and so on and all works fine. But when I try to get a
>table into it I works OK but a heap of <br> are added in before the
>table shows meaning that I have to scroll right down the page to be able
>to see anything.

If you type in text into the longtext field, line breaks have to be
translated into <br /> tags other wise they would not show in html. The
trouble is, the function that does the translation does not know you are
pasting a table and happily converts all the line breaks to <br />.

Now if you remove the nl2br() function then it will prevent it happening
for those entries that need it. What you need is something that will
apply the function only if it is needed. The exact way you do this
depends on how the nl2br() function has been applied in the code.

For instance you might have:-

echo nl2br($myrow['longdesc']);

in this case you could do something like:-

//check if the data contains the string '<table'
if(strpos($myrow['longdesc'], "<table")===false){
//if it doesn't, we need the <br /> tags
echo nl2br($myrow['longdesc']);
}
else{
//we don't need any <br /> tags
echo $myrow['longdesc'];
}

Note that this assumes that the string '<table' will only occur when you
are actually using a table and will not occur when you are not.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
.



Relevant Pages

  • Re: Multi-Language Site
    ... a meaningfull string would be a better option IMO, ... GetTrans(StringId, LanguageId) function, to fetch the wanted translated ... and also request them by page (less data to request = ... you might consider storing all translation data in the Application ...
    (microsoft.public.inetserver.asp.db)
  • Re: Which is this sentence
    ... But in order to achieve this translation ... is objectionable in NAFL). ... This superposition state is similar to the Schrodinger cat's ... Now define the "fixed point term" for any string S to be ...
    (sci.logic)
  • Re: Removing html tags from field
    ... You didn't happen to name the module KillHTML, ... >> Public Function KillHTML(sText As String, ... Dim iRight As Integer ... >>> Is there a way to remove html tags from a memo field? ...
    (microsoft.public.access.queries)
  • Re: Language Selcection Philosophy
    ... This is the general approach of GNU gettext, ... The basic idea is that each string literal is replaced by a call to ... A utility extracts all these from the source and builds a "translation ... In the actual code, the _macro invocations ...
    (comp.arch.embedded)
  • Re: Anyone wanna help with a compression routine (new type)
    ... Pi is an infinite pseudorandom string. ... we know: For every language a part of at least 1 ... The problem is an important one as the compression of an algorithm ... translation by having a language pair. ...
    (sci.math.research)