Jump to content

Recommended Posts

Ok thanks that kind of worked but now I have another problem I won't post the entire file but this should be enough for you to see what I mean.

 

<?php
if ($title && $short && $full)
    {
    $query = "INSERT INTO news (title, short, full, author, authorid, cat, date) 
VALUES ('$title', '$short', '$full', '$author', '$authorid', '$cat', NOW())"; 
    $result = @mysql_query($query);
if ($result)
    {
$show = "SELECT title, short, author, authorid, cat, id, date_format(date, '%e/%M/%Y - %H:%i') as prettydate FROM news ORDER by id DESC LIMIT 1";
$result = mysql_query($show) or die(mysql_error());
echo "<a href=\"http://www.veraci7y.net/news/view.php?id={$row['id']}\" title=\"View News Article\" class=\"newstitle\">{$row['title']}</a>";
            echo "    <a href=\"http://www.veraci7y.net/news/edit.php?id={$row['id']}\" target=\"blank\" title=\"Edit Article\" class=\"user\">Edit</a>  <a href=\"http://www.veraci7y.net/news/delete.php?id={$row['id']}\" target=\"blank\" title=\"Delete Article\" class=\"user\">Delete</a>";
        echo "<p class=\"newsinfo\">Posted by <a href=\"http://www.veraci7y.net/forums/index.php?showuser={$row['authorid']}\" class=\"user\" title=\"View Member's Profile\">{$row['author']}</a> <span class=\"newsdate\">{$row['prettydate']} EST</span></p><p class=\"newscontent\">";
        echo parseme("{$row['short']}");
	echo "</p><br />";
  }

else
    {
  echo '<p class="warning">News Article could not be added.</p>';
  }
}

else
    {
    echo '<p class="warning">All fields are required.</p>';
  }
}
?>

 

Cause I'm using ajax to send the form and I want it to show the news article that you just posted if it was successful.

How isn't there it's auto increment so of course it will have the highest id  ???

 

Basically if the insert query was successful I want to echo the result but like...

 

Title  Edit  Delete

 

Posted by Name Date

 

Story

 

I'm submitting the form with ajax so basically it should look like when you are adding news it is updating in real time.

Well I have it working perfectly everything shows except the id.

 

<?php
$show = "SELECT id FROM news ORDER by id DESC LIMIT 1";
$result = mysql_query($show) or die(mysql_error());
$showid = $row['id'];

echo "<a href=\"news/view.php?id=$showid\" title=\"View News Article\" class=\"newstitle\">$title</a>";
echo "<a href=\"news/edit.php?id=$showid\" target=\"blank\" title=\"Edit Article\" class=\"user\">Edit</a><a href=\"news/delete.php?id=$showid\" target=\"blank\" title=\"Delete Article\" class=\"user\">Delete</a>";
echo "<p class=\"newsinfo\">Posted by <a href=\"forums/index.php?showuser=$authorid\" class=\"user\" title=\"View Member's Profile\">$author</a> <span class=\"newsdate\">a second ago.</span></p><p class=\"newscontent\">";
echo parseme("$short");
echo "</p><br />";
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.