Jump to content

Archived

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

nubble

echoing spaces?

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>';
} ?>

Share this post


Link to post
Share on other sites
[b]Update:[/b] You need a[tt] . [/tt]between your quotes and the next variable.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
Thanks for your help everyone.  Got the darn thing working now!

-Amy

Share this post


Link to post
Share on other sites

×

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.