Jump to content

echoing spaces?


nubble

Recommended Posts

I know this is probably a stupid question, but I have to ask :)  How do you get PHP to echo a space?  code is horking... any ideas?  right now I"m trying to echo ' ' - server doesn't like that too much :)

<?
mysql_connect("bleh.net", "bleh", "bleh");
mysql_select_db("chondros");
$critter = "BM05J10";
$sql = "SELECT `snakeID`, `locality`, `neonate_color`, `sex`, `description` FROM `general` WHERE `snakeID` LIKE '$critter'";
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query)){
echo '<p class="heading">';
echo $row['locality']. '&nbsp;' $row['sex']. '</p>';
echo '<hr size="1" noshade color="#5B7331">';
echo '<p class="text1">';
echo $row['neonate_color'].'<br />';
echo $row['description'].'</p>';
} ?>
Link to comment
https://forums.phpfreaks.com/topic/23901-echoing-spaces/
Share on other sites

was playing around wonder if this will work?

[code]

<?php

mysql_connect("bleh.net", "bleh", "bleh");
mysql_select_db("chondros");

$critter = "BM05J10";

$sql = "SELECT `snakeID`, `locality`, `neonate_color`, `sex`, `description` FROM `general` WHERE `snakeID` LIKE '$critter' ";

$query = mysql_query($sql)or die("query problam mysql()");

while($row = mysql_fetch_assoc($query)){

$x= "<p class='heading'> ".$row['locality']." \t ".$row['sex']." </p>";
$x.= "<hr size='1' noshade color='#5B7331'>";
$x.= "<p class='text1'>";
$x.= " ".$row['neonate_color']." ";
$x.= " ".$row['description']."</p>";

echo $x;
}
?>

[/code]


This is how i bedug the code to see if it worked and it did ok.

[code]
<?php


$row['locality']="london";
$row['sex']="male";
$row['neonate_color']="silver";
$row['description']="i am nice";

$x= "<p class='heading'> ".$row['locality']." \t ".$row['sex']." </p>";
$x.= "<hr size='1' noshade color='#5B7331'>";
$x.= "<p class='text1'>";
$x.= " ".$row['neonate_color']." ";
$x.= " ".$row['description']."</p>";

echo $x;
?>

[/code]

result
[code]

london male


--------------------------------------------------------------------------------

silver i am nice

[/code]
Link to comment
https://forums.phpfreaks.com/topic/23901-echoing-spaces/#findComment-108687
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.