Re: Need Help
| From: | Peter Beckman | Date: | Sun, 17 Nov 2002 05:12:12 +0000 |
| Subject: | Re: Need Help | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23420@lists.php.net to get a copy of this message | ||
A few suggestions.
$show["Time"] doesn't exist; replace the 5 lines after your "while" with
this:
$sms_time=$show["sms_time"];
$smsc=$show["smsc"];
$org_sms=$show["org_sms"];
$dest_sms=$show["dest_sms"];
$msg_content=$show["msg_content"];
Also, so save you some formatting headaches, change your $s_sms to this:
$s_sms="SELECT from_unixtime(unix_timestamp(sms_time)) as
sms_time,smsc,org_sms,dest_sms,msg_content FROM dlr WHERE smsc=('Receive SMS')";
This will format your sms_time from the DB as year-month-day hour:minute:second
select from_unixtime(unix_timestamp(now()));
+--------------------------------------+
| from_unixtime(unix_timestamp(now())) |
+--------------------------------------+
| 2002-11-17 00:11:57 |
+--------------------------------------+
Peter
On Sun, 17 Nov 2002, Afif wrote:
> Dear All,
> I would like to represent data from table dlr, but I could have
> nothing with this script
>
> $s_sms="SELECT sms_time,smsc,org_sms,dest_sms,msg_content FROM dlr WHERE
> smsc=('Receive SMS')";
> $result = mysql_query($s_sms);
> if (!$result) error_message(sql_error());
>
> //Header of Table
>
> echo "<html>";
> echo "<title>Hasil</title>";
> echo "<body><br>";
> echo "<table align=center width=95% border=1>";
> echo "<tr>";
> echo "<td width=23%>Time</td>";
> echo "<td width=8%>Action</td>";
> echo "<td width=11%>From</td>";
> echo "<td width=13%>Destination</td>";
> echo "<td width=45%>Message</td>";
> echo "</tr>";
>
> //detail of row
>
> while ($show = mysql_fetch_array($result)) {
> $sms_time=$show["Time"];
> $smsc=$show["Action"];
> $org_sms=$show["From"];
> $dest_sms=$show["Destination"];
> $msg_content=$show["Message"];
>
> Make Best Result of timestamp;
> $sms_time = substr($show["Time"],0,4).'-'.
> substr($show["Time"],4,2).'-'.
> substr($show["Time"],6,2).'-'.
> substr($show["Time"],8,2).':'.
> substr($show["Time"],10,2).':'.
> substr($show["Time"],12,2);
>
> echo "<tr>";
> echo "<td>$sms_time </td>";
> echo "<td>$smsc </td>";
> echo "<td>$org_sms </td>";
> echo "<td>$dest_sms </td>";
> echo "<td>$msg_content </td>";
> echo "</tr>";
> }
> echo "</table>";
> echo "</body>";
> echo "</html>";
>
> DO I miss some thing with above script ??
> pls help me
> Highly appreciate for yr help
>
> --
> Warm regards,
> Afif
> mailto:afif@sur.ogs-id.com
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
---------------------------------------------------------------------------
Peter Beckman Systems Engineer, Fairfax Cable Access Corporation
beckman@purplecow.com http://www.purplecow.com/
---------------------------------------------------------------------------