Jump to content

Aftermath

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Aftermath's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I don't suppose you can post that link again. It seems it is gone and I neglected to bookmark it last nite.
  2. I can't for the life of my figure out how to put it into an array. I have gone to the php.net site and read through several pages of about array's and read the strtotime page. I understand the logic i need to make this page, but I just don't have the expereince or knowledge to do it. Does anyone have a link to a tutorial or something similar to this?
  3. ok. I think I will be able to figure it out. thanks ^_^
  4. Hello all. What i'm trying to do here is make it so that when it reads the info from the database it will orgranize it date. EX: June 28 2006 *Whatever title* *Second title if there is one* June 27 2006 *Another title* Below is my code of what i have so far... Any help would be much appreciated. [code]    <?php mysql_connect ('localhost', ' ', ' '); mysql_select_db (' '); $result = mysql_query("SELECT * FROM post_table ORDER BY id DESC LIMIT 10"); while ($row = mysql_fetch_array($result)) {        $id = $row['id'];         $title = $row['title'];         $user = $row['username'];     $date = date("d/n/y", $row['timestamp']);                                echo "<a href='entries.php?id=$id'>($date) $title - $user</a><br />"; }                 ?> [/code]
  5. ** I commented the line: [code]$entry = nl2br($entry);[/code] out and when i changed it back it started working... Can php be picky like that? Hello all. I have been working on a blog type site and I have encountered an issue. Whenever I try to create a post that has a line break in it, it says the data was succesful entered into the table but when I try to display it, it will only display text until the first linebreak. I am unsure if this is a php or mysql problem, but the following code is my script to insert the info into the table. [code] <?php if (isset($_POST['submit'])) {     $title = htmlspecialchars(strip_tags($_POST['title']));     $entry = $_POST['entry'];     $username = $_POST['username'];     $timestamp = strtotime($current_month . " " . $current_date . " " . $current_year);     $entry = nl2br($entry);     mysql_connect ('localhost', '******', '******');     mysql_select_db ('******');     $sql = "INSERT INTO post_table (timestamp,username,title,entry) VALUES ('$timestamp','$username','$title','$entry')";     $result = mysql_query($sql) or print("Error!.<br />" . $sql . "<br />" . mysql_error());     if ($result != false) {         print "Your entry has successfully been entered!";     } } if (isset($_POST['edit'])) {     $idnum = $_POST['idnum']; header("Location:update.php?id=" . $idnum);     }     mysql_close(); ?> [/code]
  6. I figured it out. Sorry for the hassle. Here's what i changed in case anyone else has the same issue. [code] echo "<a href='update.php?id=$id'> $id </a><br />"; [/code] I know this should be as hard as it is.. but I can't get it to work for the life of me. [code] <?php mysql_connect ('localhost', '******', '******'); mysql_select_db ('*****'); $result = mysql_query("SELECT * FROM post_table ORDER BY id DESC LIMIT 5"); while ($row = mysql_fetch_array($result)) {     $id = $row['id'];        echo "<a href='update.php?id=' . $id> $id </a><br />"; } ?> [/code] The link that is supposed to be echoed isn't working properly. It just doesn't add the id that is meant to be there but will display it as text.
  7. That makes sense. The 'i' part was a little confusing to me before. Thanks for all the help mate :)
  8. Thanks a lot! It worked ^_^ Could you possibly explain it so I know what it means? [code] function truncate_string($details,$max) {     if(strlen($details)>$max)     {         $details = substr($details,0,$max);         $i = strrpos($details," ");         $details = substr($details,0,$i);         $details = $details." ..... ";     }     return $details; } while($row = mysql_fetch_array($result)) {     $date = date("l F d Y", $row['timestamp']);     $title = $row['title'];     $entry = truncate_string($row['entry'],20);     $name = $row['username'];     $id = $row['id']; [/code]
  9. Hello, I'm working on creating a blog and I need a hand. Right now, I have the entry being called from the database and being displayed in a table. [code] while($row = mysql_fetch_array($result)) {     $date = date("l F d Y", $row['timestamp']);     $title = $row['title'];     $entry = $row['entry'];     $name = $row['username'];     $id = $row['id'];     ?> <table width="100%" align="left"> <tr><td><u> <?php echo $title; ?></u></td> <td align="right"> <?php echo $date; ?></td></tr> <tr><td colspan="2"><b><?php echo $name; ?></b></td></tr> <tr><td colspan="2"> <?php echo $entry; ?></td></tr> <tr><td colspan="2"><br /></td></tr> <tr><td colspan="2"><a href="blog_entries.php?id=<?php echo $id; ?>">View Post</a></td> <tr><td colspan="2"><HR WIDTH="100%"></td></tr> </table> <br />     <?php } ?> [/code] I was wondering how would I go about making it only display, say the first 150 characters of the enrty?
  10. shenniko, you are right about the layout. I tired using single quotations just to test and it is putting the datestring down a line. So I tested the code you suggested. It works for the fist post but it just piles all the other posts on top of each other. I should have mentioned I am modifing a shout box to be similar to a blog idea. Thanks for setting me down the right path shenniko :) It seems i just need to have it create mulitple tables now? hvle, I didnt think I could use css to format a string like that. Thanks for the suggestion. I will look into it :)
  11. Hello all. This seems to be a relatively simple idea, but I can't get it to work. I have a string and I want part of that string right align. Using <p> doesn't work because I want the text on the same line as the title of the post. And when I use <h6 style="align: right"> my script just won't work. Below is my string. Any help would be great ^_^ [code] .... $datestring = $day . $date . $month . "," . $year;     if ($name && $tag) echo "<u>" . $title . "</u>" . "<h6 style="align: right">" . $datestring . "</h6>" . <"br />" . $newdate . "<br />" . $name . "<br />" . $tag . "<br /><br />" ; .... [/code]
  12. [code] $stringData = $newtxt; $stringData .= $filedata; [/code] Thanks alot! I got it to work after figuring out what the '.=' does lol.
  13. Thanks. I will try this and post my results. But this is all new to me so I don't really know what I'm doing exactly. Ok,it worked ^_^ thanks a lot. But I was wondering if I could reverse the order it was displayed in so that the last tag is the first displayed
  14. Hello, I'm new to php and I have been having difficulty :P I have something similar to a shoutbox and in it I have 4 fields; User, Tag, Date, and Title. My problem is when I try to display the string. I can't get it formatted the way I want and I can't find a tutorial out there that describes what I need. [code] <?php $name = $_POST["name"]; $tag = $_POST["tag"]; $title = $_POST["title"]; $newdate = date("H:i"); if($name && $tag)     { $file = "blog.dat"; $filecopy = $title . ".dat"; $newtxt = ($name . "," . $newdate . "," . $tag . "," . $title ."\n"); ..... <?php $boardarray = file("blog.dat"); while (list(,$oneline) = each($boardarray)) {     $name = substr($oneline,0,strpos($oneline,","));     /*$sdate = substr($online,strpos($oneline,",")+1,strlen($oneline));     $tag = substr($online,strpos($sdate)+1,strlen($oneline));*/     $tag = substr($oneline,strpos($oneline,",")+1,strlen($oneline));     if ($name && $tag) echo "<b>" . $name . "</b>" . $tag .   "<br />"; } ?> ..... [/code] Here is what I have been trying to get working. What is happening is it formats the User only and afterwards just posts the rest of the data in the file. I think the problem is in that I don't know how to set up the string commands to start reading at the second comma (since it's a comma delimited file). Any help would be much appreciated.
×
×
  • 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.