Jump to content

php & mysql [programming stuff]


lacroix

Recommended Posts

Need help here.

[php/mysql]

I am a noobie...(real noobie, no joke!)

If I have a database :

  • date
  • description
  • user_id
  • ip_addr
  • data_id



How do I code to make it display like a blog system e.g:

 

This is sumthing like a data entry system where the supervisor will input the movement/chronology for the staff and work done on a certain task.

 

The date, time, ip_adr and name will be automatically inserted at the instance of editing the work data.

 

Its hard for me to show here because I'm a noobie and just getting the hang on programming.

 

I guess it is much or less like a blogging system.

Link to comment
Share on other sites

<?php

$query = "SELECT date, description, user_id, ip_addr, data_id FROM table";
$result = mysql_query($query)or die(mysql_error());

while ($row = mysql_fetch_assoc($result)){
   echo $row['date'].'<br>';
   echo $row['ip_addr'].'<br>';
   echo $row['description'].'<p>';
}

?>

 

That will display the data like you listed above. You might have to format your date/time how you want it, I'm not sure how you have that stored in the DB.

Link to comment
Share on other sites

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.