timmah1 Posted January 17, 2007 Share Posted January 17, 2007 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 Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 17, 2007 Share Posted January 17, 2007 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 Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 17, 2007 Author Share Posted January 17, 2007 Thanks Ted, works perfectWould I use H:i:s for the time also? Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 17, 2007 Share Posted January 17, 2007 yeah, you can add that in here:date('F d, Y H:i:s',$date); Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 17, 2007 Author Share Posted January 17, 2007 The time thing works good, except it is showing today's dateI need it to display the signup_dateHow 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] Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 17, 2007 Share Posted January 17, 2007 I am not sure why it is displaying today's date, try echoing:$r['signup_date']and see if you get the right date...Ted Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 17, 2007 Author Share Posted January 17, 2007 I'm getting a blank responseHere is what Im using[code]$signup_date = strtotime($r['signup_date']);$signup_date = date('F d, Y h:i',$signup_date);echo ($r['signup_date']);[/code] Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 17, 2007 Share Posted January 17, 2007 Have you connected to your database correctly?the connection should look like:mysql_connect("", "", "") or die(mysql_error());and the bit before it should look:$read = mysql_query("SELECT signup_date FROM table");$r = mysql_fetch_array($read);Ted Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 17, 2007 Author Share Posted January 17, 2007 Yes I have[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>[/code] Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 17, 2007 Share Posted January 17, 2007 i think $row[signup_date] should be $row['signup_date']try it.Ted Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 17, 2007 Author Share Posted January 17, 2007 that didn't work either, when i do that, the whole page is blankwhen 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 Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 17, 2007 Author Share Posted January 17, 2007 I figured it out, this is resolved, but I can't seem to see the link to mark as resolved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.