2017년 7월 14일 금요일

Why is it wrong to put a space at the end of a sentence?


When I select a record from a ListPicker, if it contains a space after the last word, it does not show it to me on the screen:

Ex: Antonio Navas Espejo

If after Mirror I leave a space, I would give error.

Here is the code I use:

php:



if ($boton == "btnVerarticulos"){
//$articulo = $_GET['articulo'];
$query="select * from articulos ORDER BY articulo ASC";
$result = mysql_query($query);

  while($linea = mysql_fetch_object($result))
      echo $linea->articulo."#";
  echo "^";
}
$articulo = $_POST['articulo'];
$query="select * from articulos where articulo like '$articulo'";
$result = mysql_query($query);
  // Obtém o resultado de uma linha como um objeto
  while($linea = mysql_fetch_object($result)) {
      echo $linea->articulo."#";
  echo $linea->cantidad."#";
  echo $linea->referencia."#";
  echo $linea->ubicacion."#";
  }
  echo "^";

--
try this script https://puravidaapps.com/mysql.php instead

-- 
Thanks Taifun, I have finally opted for the trim () function:


// String example with leading and trailing whitespace $ String = "sentence sentence phrase"; $ String_format = trim ($ string); Echo "The original string is this: $ string." 'And the formatted one is this: $ string_formatted.

-- 
the php mysql API is deprecated, you should use mysqli instead...
-- 

댓글 없음:

댓글 쓰기