I use mysql_fetch_array and get the correct row. In the simple code below:
$result = mysql_query( “SELECT * from Members where Tail_Num=‘N1074Y’” );
while ($a_row = mysql_fetch_array( $result ) ) {
$Name = $a_row[‘Name’];
The field contains “Firstname Lastname”. But when I look at the value of $Name, it is only “Firstname”.
If I print $a_row[‘Name’], then I get “Firstname Lastname”.
It appears that spaces in a text string truncate the assignment. How do I work around this?
This should not be a case. Probably you’re outputting this value to html element and not using quotes/double quotes? For example, if you do this:
[php]<?php
echo “”;
?>[/php]
Everything after first space in the value of $Name will not be displayed in html.
echo ‘<input name = “name” size=30 value =’;
echo htmlspecialchars($a_row[‘Name’]);
echo ‘">’;
See, at the end of the first line you have =’; this is correct php code, but still incorrect HTML (you are missing opening double quote). Correct code is: