Jump to content


Photo

echoing spaces?


  • Please log in to reply
4 replies to this topic

#1 nubble

nubble
  • Members
  • PipPip
  • Member
  • 19 posts
  • LocationMiddle of nowhere, ME

Posted 13 October 2006 - 09:17 PM

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

#2 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 13 October 2006 - 09:21 PM

just echo " ";  ;)
I don't need your script, I'll try to write it myself

#3 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 13 October 2006 - 09:23 PM

Update: You need a . between your quotes and the next variable.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 14 October 2006 - 03:35 AM

was playing around wonder if this will work?


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



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

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


result

london male 


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

silver i am nice


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 nubble

nubble
  • Members
  • PipPip
  • Member
  • 19 posts
  • LocationMiddle of nowhere, ME

Posted 17 October 2006 - 03:07 PM

Thanks for your help everyone.  Got the darn thing working now!

-Amy




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users