So this little problem has stumped me for close to an hour, and I know it's
something easy...
I'm using PHP to select field values from a record in a MySQL database, and
display those values inside of text boxes in a form (which is used to allow
folks to update records). The SELECT statement:
SELECT
`last_name`,`first_name`,`street`,`city`,`state`,` zip`,`area_code`,`phone`,`
email`,`badge`
FROM $table
WHERE `last_name` = 'mccammon' AND `first_name` = 'keith'
This is called via a standard connect string, the functional portion of
which looks like this:
$result=MYSQL_QUERY($query) or die(mysql_error());
$data=mysql_fetch_array($result);
This all works great, *but* the `street` value normally looks like this:
2000 L Street NW
And when I use <? print $data[street] ?> to print the `street` value within
the text box, all I see is:
2000
Apparently the first space in the field value is the end of the road, for
some reason. I'm guessing this is something easy to handle, but I'm a
novice here, so please go easy!
Thanks
Keith 5 6804
On 13-Nov-2003, "Keith W. McCammon" <km@km.com> wrote: I'm using PHP to select field values from a record in a MySQL database, and display those values inside of text boxes in a form (which is used to allow folks to update records). The SELECT statement:
SELECT `last_name`,`first_name`,`street`,`city`,`state`,` zip`,`area_code`,`phone`,` email`,`badge` FROM $table WHERE `last_name` = 'mccammon' AND `first_name` = 'keith'
This is called via a standard connect string, the functional portion of which looks like this:
$result=MYSQL_QUERY($query) or die(mysql_error()); $data=mysql_fetch_array($result);
This all works great, *but* the `street` value normally looks like this:
2000 L Street NW
And when I use <? print $data[street] ?> to print the `street` value within the text box, all I see is:
2000
Apparently the first space in the field value is the end of the road, for some reason. I'm guessing this is something easy to handle, but I'm a novice here, so please go easy!
enclose the value in quotes <input ... value="<? print $data['street'];
?>"...>
(You should also enclose street in apostrophies unless you've defined it as
a constant or are using it in a quoted string.)
--
Tom Thackrey www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
On Thu, 13 Nov 2003 13:56:44 -0500, "Keith W. McCammon" <km@km.com>
wrote: SELECT `last_name`,`first_name`,`street`,`city`,`state`, `zip`,`area_code`,`phone`,` email`,`badge` FROM $table WHERE `last_name` = 'mccammon' AND `first_name` = 'keith'
You don't need the single quotes on the fieldnames.
And when I use <? print $data[street] ?> to print the `street` value within the text box, all I see is:
try...
print $data["street"];
kafooey
- ka*****@nospam.yahoo.co.uk
- http://www.pluggedout.com/blog
Thanks, Tom! That did the trick. Always the easy stuff that gets me...
On Thu, 13 Nov 2003 19:18:34 GMT, kafooey <ka*****@nospam.yahoo.co.uk>
wrote: try... print $data["street"];
Of course... just re-read your question...
You need to make sure you put your value within quotes in the form
input tag.
(see the other reply).
I guess this is a case of RTFQ :)
kafooey
- ka*****@nospam.yahoo.co.uk
- http://www.pluggedout.com/blog
Thanks for the suggestion. Enclosing this alone in quotes doesn't do it,
but enclosing the value itself does. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul Watson |
last post by:
It is clear that just using 'print' with variable names is relatively
uncontrollable. However, I thought that using a format string would
reign the problem in and give the desired output.
Must...
|
by: D. Bron |
last post by:
Hello,
I've been building my *.sln files from the command line using devenv.exe.
The problem I have is that devenv won't print its results to stdout; I have
to specify /out file.ext and then...
|
by: VB Programmer |
last post by:
Asp.net 2.0...
I have an SqlDataSource on my aspx form. It's defined as...
<asp:SqlDataSource ID="sdsCoupons" runat="server" ConnectionString="<%$
ConnectionStrings:ConnectionString %>"...
|
by: sachin |
last post by:
Hi
I am working on report using print preview dialog control in
windows application. Report is displayed properly in control. With
paper size 850X1350 (Legal)(Lanscape mode=true) .
But when...
|
by: intscript |
last post by:
Hi everyone
Is is possible to retrieve data using multiple select. Here is my SQL code:
select sum(nPassengers) Planned, Actual, (sum(Planned) - Actual) Variance
from (
select iDeptCode,...
| |
by: Sanders Kaufman |
last post by:
I've noticed that some code analyzers comment that the type of data
returned by my functions is "unknown" in the following syntax:
function fnFooBar($aryParameters) {
$bRetVal = True;
return...
|
by: CSINVA |
last post by:
I have a stored procedure that returns columns from a table called
UserProfile. Within the table, it has a column called ProfielD,
PropertyValue, Visitbility. I need to be able set the values...
|
by: Mohan Krishna |
last post by:
Hi EveryOne!
Please any one help in the following Q's. I am using to print a restaurant bill using PRINT command in the code.
1. How can I change the FONT of the text to be printed?
2. How can I...
|
by: =?Utf-8?B?QnJhc3NpY2FOaWdyYQ==?= |
last post by:
Greetings,
I have a web application that prints a form using PrintDocument on the
server. Currently it is set up to print to the default printer (on the
server).
My users would like to be...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |