Jump to content

Insert and Display from MySQL


timmah1

Recommended Posts

How do I insert the IP Address of a person that has signed up?

It worked before, but now it won't, any suggestions?
[code]
$ip = $REMOTE_ADDR;
$insert = mysql_query("insert into $table values ('NULL','".$_POST["username"]."',"."PASSWORD('".$_POST["password"]."'),'".$_POST["email"]."',NOW(),'".$_POST["ip"]."',
[/code]

Also, how do I display the timestamp in a way of Month,Day,Year instead of how it's inserted into the database?
It's in the database like this
[b]2006-12-29 10:42:45[/b]
But I want to display it like this
[b]December 29, 2006[/b]

Thanks in advance
Link to comment
Share on other sites

this is how I got my ip
[code]<?php
$ipaddress = $_SERVER['REMOTE_ADDR'];
?>
[/code]
looks different from yours, so give it a try.

for the date:
[code]<?php
$date = strtotime($r['date'])
$date = date('F d, Y',$date);?>
[/code]

'F d, Y' is the bit you change to suit your format of time.
Ted
Link to comment
Share on other sites

The time thing works good, except it is showing today's date

I need it to display the signup_date

How do I do that?

Also, my structure in the database is datetime for the date
[code]
signup_date  datetime    No  0000-00-00 00:00:00 
[/code]
[code]
$signup_date = strtotime($r['signup_date']);
$signup_date = date('F d, Y h:i',$signup_date);
[/code]

Link to comment
Share on other sites

that didn't work either, when i do that, the whole page is blank

when I do this
[code]
while ($row = mysql_fetch_array($result)) {
$date = strtotime($row['signup_date']);
$signup_date = date('F d, Y h:i',$signup_date);
echo "<tr>
<td>$row[signup_date]</td>
<td><a href=http://www.stagingtree.com/$row[UserFrom]>$row[UserFrom]</a></td>
<td><a href=http://www.stagingtree.com/myaccount.php?op=view&id=$row[mail_id]>$row[Subject]</a></td>
<td>$row[status]</td>
<td>Delete</td>
</tr>";
[/code]
everything shows up but the date
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.