amylou Posted August 23, 2007 Share Posted August 23, 2007 not sure if this is a php or mysql question so i am going to post in both places. sorry if this is the wrong forum. i am looking to have spaces between the output from a query. below is the code and then below that is what the output looks like echo "<p><strong>These are the dates that you have requested off!!!!</strong></p>"; $sql ="SELECT first, last, requestedDate FROM timeoff WHERE last = '$last' AND first = '$first'"; $query=mysql_query($sql) or die("Query failed : " . mysql_error()); while($row = mysql_fetch_assoc($query)) { echo "<p>"; echo $row['first'] ; echo $row['last']; echo $row['requestedDate']; echo "</p>"; AmyCoppola2007-08-17 Amy Coppola2007-08-01 AmyCoppola2007-08-23 i only posted the section of code that is relevant i think Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/ Share on other sites More sharing options...
nathanmaxsonadil Posted August 23, 2007 Share Posted August 23, 2007 ??? I dont understand what you mean Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332428 Share on other sites More sharing options...
Fadion Posted August 23, 2007 Share Posted August 23, 2007 What is the question?? EDIT: Im just giving it a go with chance. If what u mean is to seperate with a space two mysql records then: echo $row['first']; echo " "; echo $row['last']; //it will output "First Last" Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332430 Share on other sites More sharing options...
lemmin Posted August 23, 2007 Share Posted August 23, 2007 I believe this is an HTML question, actually. try: echo $row['first'] . "<br><br>"; echo $row['last'] . "<br><br>"; echo $row['requestedDate']; Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332431 Share on other sites More sharing options...
amylou Posted August 23, 2007 Author Share Posted August 23, 2007 i would like to have a space between the name and the date Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332432 Share on other sites More sharing options...
nathanmaxsonadil Posted August 23, 2007 Share Posted August 23, 2007 use this echo "<p>"; echo $row['first'] ; echo $row['last']." "; echo $row['requestedDate']; echo "</p>"; instead of this echo "<p>"; echo $row['first'] ; echo $row['last']; echo $row['requestedDate']; echo "</p>"; Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332434 Share on other sites More sharing options...
amylou Posted August 23, 2007 Author Share Posted August 23, 2007 AmyCoppola 2007-08-17 AmyCoppola 2007-08-17 Amy Coppola 2007-08-01 Amy Coppola 2007-08-01 AmyCoppola 2007-08-23 AmyCoppola 2007-08-23 this is the out put i get from using the last code from nathanmaxsonadil. puts a space but also doubles the output Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332437 Share on other sites More sharing options...
Fadion Posted August 23, 2007 Share Posted August 23, 2007 Is it me or no one cant see the double quotes in the output?? Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332439 Share on other sites More sharing options...
nathanmaxsonadil Posted August 23, 2007 Share Posted August 23, 2007 Is it me or no one cant see the double quotes in the output?? what do you mean ??? Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332442 Share on other sites More sharing options...
Fadion Posted August 23, 2007 Share Posted August 23, 2007 amylou is saying that the space is put, but it also have double quotes, which i cant see in the output he provided (the double quotes i mean). It was kinda ironic Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332444 Share on other sites More sharing options...
amylou Posted August 23, 2007 Author Share Posted August 23, 2007 what i meant to say was that it shows the output of what is there twice ex. amycoppola 2007-08-17 amy coppola 2007-08-17 does this for everything Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332448 Share on other sites More sharing options...
Fadion Posted August 24, 2007 Share Posted August 24, 2007 Oh my fault i thought u meant double quotes The code is just adding a space between records, it has nothing to do with duplicate records. U must have something in your code. Try posting the whole 'while' part of the script. Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332468 Share on other sites More sharing options...
AndyB Posted August 24, 2007 Share Posted August 24, 2007 Then it looks as though you have copy/pasted something in twice. Approximately what you want is this: $sql ="SELECT first, last, requestedDate FROM timeoff WHERE last = '$last' AND first = '$first'"; $query=mysql_query($sql) or die("Query failed : " . mysql_error()); while($row = mysql_fetch_assoc($query)) { echo "<p>"; echo $row['first'] ." ". $row['last']. " ". $row['requestedDate']; echo "</p>"; } Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332469 Share on other sites More sharing options...
amylou Posted August 24, 2007 Author Share Posted August 24, 2007 thank you all for your help. it now looks correct. Quote Link to comment https://forums.phpfreaks.com/topic/66415-solved-spacing/#findComment-332490 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.