Jump to content

mullberrymae

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mullberrymae's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well , that ended the loop but now I am only getting one record
  2. this is only returning one record, when I know there are more, and it's an endless loop crashing my browser, can someone tell me how my brackets are wrong, or what is wrong? if (isset($_POST['search'])){ $keyword=$_POST['keyword']; } $sql="SELECT id, fname, lname FROM obituaries WHERE lname LIKE '%$keyword%' OR fname LIKE '%$keyword%' ORDER BY id DESC"; $results = mysql_query($sql); $num = mysql_num_rows ($results); if ($num > 0 ) { $i=0; while ($i < $num) { $id = mysql_result($results,$i,"id"); $fname = mysql_result($results,$i,"fname"); $lname = mysql_result($results,$i,"lname"); ?> <a href="view.php?id=<?php echo ($id); ?>"><?php echo($fname); ?> <?php echo($lname); ?></a> <?php } } ?> Thanks in advance
  3. I am getting repeat results, need help to stop this $sqlgb ="SELECT * FROM `guestbook`JOIN `obituaries` ON (guestbook.obits_id = '$id') "; $results=mysql_query($sqlgb) or die("Error: ". mysql_error(). " with query ". $sqlgb); $num = mysql_num_rows($results); if ($num > 0 ) { $i=0; while ($i < $num) { $id = mysql_result($results,$i,"id"); $obits_id = mysql_result($results, $i, "obits_id"); $name = mysql_result($results,$i,"name"); $email = mysql_result($results,$i,"email"); $message = mysql_result($results, $i, "message"); $postdate = mysql_result($results,$i,"postdate"); //$deceased = mysql_result($results, $i "fname"); $date = convertdate($postdate); ?> <p class="ptext">Message From: <a href="mailto:<?php echo $email; ?>"><?php echo $name; ?></a></p> <p class="ptext"><?php echo $postdate; ?></p> <p class="ptext"><?php echo $message; ?></p> <p> <div align="center"><h2> <a href="gbview.php?id=<?php echo($id); ?>">View Guestbook</a> | <a href="gbpost.php?id=<?php echo($id); ?>">Sign the Guestbook</a></h2></div> </p> <?php ++$i; } } else { echo($results['obituaries.fname']); } mysql_close(); ?>
  4. Thanks for responding. when I echo $posdate I get a date like this: 2011-04-14 I just want to format that to m d y $sqlgb ="SELECT * FROM `guestbook`, `obituaries` WHERE guestbook.obits_id = '$id' "; $results=mysql_query($sqlgb) or die("Error: ". mysql_error(). " with query ". $sqlgb); $num = mysql_num_rows($results); if ($num > 0 ) { $i=0; while ($i < $num) { $id = mysql_result($results,$i,"id"); $obits_id = mysql_result($results, $i, "obits_id"); $name = mysql_result($results,$i,"name"); $email = mysql_result($results,$i,"email"); $message = mysql_result($results, $i, "message"); $postdate = mysql_result($results,$i,"postdate"); $date = date('m d,Y', "$postdate"); thats the code block I'm using
  5. why does this : $date = date('m d,Y', "$postdate"); work to format my date output on one page yet on the other I get the dec 31 1969 output for all my dates?
×
×
  • 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.