Connecting Tech Pros Worldwide Help | Site Map

Sent data truncated?

  #1  
Old March 7th, 2006, 06:15 AM
no.mail.pls
Guest
 
Posts: n/a
Hi,

I can't send data over to another page, if the data has spaces in-between,
eg.

$row[0] = "Garden Party by the Sea" and i use the following code:

<a href=deleterecord.php?id=$row[0]&tablename=$tablename>$row[0]</a>";

then what is sent over is
$row[0]="Garden
and $tablename is not sent over at all.

How can i send over the complete $row[0] plus another variable to the next
page?

TIA


  #2  
Old March 7th, 2006, 06:35 AM
Geoff Muldoon
Guest
 
Posts: n/a

re: Sent data truncated?


no.mail@st.peters says...
[color=blue]
> I can't send data over to another page, if the data has spaces in-between,
> eg.
>
> $row[0] = "Garden Party by the Sea" and i use the following code:
>
> <a href=deleterecord.php?id=$row[0]&tablename=$tablename>$row[0]</a>";
>
> then what is sent over is
> $row[0]="Garden
> and $tablename is not sent over at all.
>
> How can i send over the complete $row[0] plus another variable to the next
> page?[/color]

This is not a PHP thing, it's a HTML thing. HTML property references (like
href and value) which are not enclosed in double quotes will break at the
first whitespace.

Try using escaped quotes (/"):
$link="<a href=/"deleterecord.php?id=$row[0]&tablename=$tablename/">$row
[0]</a>";

or I prefer to use single-quotes and concatenators for PHP and double-
quotes only for the HTML bits:

$link='<a href="deleterecord.php?id='.$row[0].'&tablename='.
$tablename.'">'.$row[0].'</a>';

Although the fact that you have such text in an "id" field indicates poor
design.

Geoff M
  #3  
Old March 7th, 2006, 07:05 AM
no.mail.pls
Guest
 
Posts: n/a

re: Sent data truncated?


Hi Geoff,

Thanks. It worked after i changed it to \"

i agree that it is poor db design, by using such variable data as primary
key. But my purpose is to create a general method for anyone to create any
table with any number of fields of their own choice, and no assumption is
made regarding their knowledge of db design.

All they have to do is live with what they have created. :-)

cheers


"Geoff Muldoon" <geoff.muldoon@trap.gmail.com> wrote in message
news:MPG.1e77d1a3d56d871598977c@news.readfreenews. net...[color=blue]
> no.mail@st.peters says...
>[color=green]
>> I can't send data over to another page, if the data has spaces
>> in-between,
>> eg.
>>
>> $row[0] = "Garden Party by the Sea" and i use the following code:
>>
>> <a href=deleterecord.php?id=$row[0]&tablename=$tablename>$row[0]</a>";
>>
>> then what is sent over is
>> $row[0]="Garden
>> and $tablename is not sent over at all.
>>
>> How can i send over the complete $row[0] plus another variable to the
>> next
>> page?[/color]
>
> This is not a PHP thing, it's a HTML thing. HTML property references (like
> href and value) which are not enclosed in double quotes will break at the
> first whitespace.
>
> Try using escaped quotes (/"):
> $link="<a href=/"deleterecord.php?id=$row[0]&tablename=$tablename/">$row
> [0]</a>";
>
> or I prefer to use single-quotes and concatenators for PHP and double-
> quotes only for the HTML bits:
>
> $link='<a href="deleterecord.php?id='.$row[0].'&tablename='.
> $tablename.'">'.$row[0].'</a>';
>
> Although the fact that you have such text in an "id" field indicates poor
> design.
>
> Geoff M[/color]


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data truncation: Data truncated for column 'date' at row 1 chromis answers 13 November 26th, 2008 02:14 PM
Truncated data using .NET 3.5 sockets VS 2008 Kenny D answers 5 March 24th, 2008 09:15 PM
Getting truncated data from sockets bil.shah@gmail.com answers 2 November 28th, 2005 11:55 PM
aspx/html file bigger than 170KB truncated z. f. answers 5 November 19th, 2005 04:26 AM