Jump to content

skippyscage

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

skippyscage's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I can successfully build a search page with the results displaying underneath on the same page. The problem is when you go to this page, it displays all the records first (probably because it's trying a blank wildcard search) - when entering a search it works fine. What I need to do is to have this page display no results on the first entry. (i.e. when the user clicks on this page) <?php $colname_qSearch = "1"; if (isset($HTTP_POST_VARS['search'])) { $colname_qSearch = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['search'] : addslashes($HTTP_POST_VARS['search']); } mysql_select_db($database_base2, $base2); $query_qSearch = sprintf("SELECT *, DATE_FORMAT(endtime, '%%d %%b %%y') AS cdate, DATE_FORMAT(date, '%%d %%b %%y') AS fdate FROM turnover WHERE title LIKE '%%%s%%' ORDER BY `date` ASC", $colname_qSearch); $qSearch = mysql_query($query_qSearch, $base2) or die(mysql_error()); $row_qSearch = mysql_fetch_assoc($qSearch); $totalRows_qSearch = mysql_num_rows($qSearch); ?> <form name="form1" method="post" action=""> <input name="search" type="text" id="search"> </form> <?php do { ?> <table border="0"><tr><th class="bgsolid"><?php echo $row_qSearch['sys']; ?></th></tr></table> <table border="0"> <tr valign="top"><td><?php echo $row_qSearch['fdate']; ?> <?php echo $row_qSearch['pmx']; ?> <span class="rb"><?php echo $row_qSearch['title']; ?></span></td></tr> <tr valign="top"><td><?php echo nl2br($row_qSearch['comments']); ?></td></tr> <tr valign="top"><td><strong><?php echo $row_qSearch['status']; ?></strong> <?php echo $row_qSearch['cdate']; ?></td></tr> <?php } while ($row_qSearch = mysql_fetch_assoc($qSearch)); ?> </table>
  2. ok - I think I know where you're coming from... the date is entered via a form into the database in DATE format you need the results on the page to display in a different format (i.e. not the SQL format) ===================================== in the SQL query (Application) SELECT *, DATE_FORMAT(date, '%d %b %y') AS fdate FROM blah blah blah etc this changes the format of the date... %d %b %y can be formatted any way by using the variables quoted in the manual or the post above then in the code on the page... <?php echo $row_Recordset1['fdate']; ?> hope that helps
  3. got that completey wrong should be nl2br ie <?php echo nl2br($row_qMemberTracking['comments']); ?>
  4. got it! after a week of looking and struggling and finally posting, I work it out! n12br should be nl12br <?php echo nl12br($row_qMemberTracking['comments']); ?> sorry for wasting any time - but at least it's here for future ref
  5. Im having trouble getting line breaks to format from a record in MySql that has been input via a form, when it's displayed in the .php page. I know this has something to do with n12br but I have no idea how to code this. I basically need the .php page to format the text exactly the same as entered in the form - i.e. a line break where the user has hit the return key between lines of text. here is the sample code... <?php echo ($row_qMemberTracking['comments']); ?>
×
×
  • 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.