 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
raninda
Joined: 10 Apr 2008 Posts: 11
|
Posted: Tue May 27, 2008 5:25 pm array, datetime data type |
|
|
|
hi,
i have table (phpmysql) named 'guestbook' and there is a field name 'guestdate' data type is datetime.
i have this code to print the field 'guestdate'
| Code: |
<?php
include "db.php";
$query=mysql_db_query($dbname, "SELECT `guestdate` FROM `guestbook` WHERE `id_guest` =42");
$row=mysql_fetch_row($query);
if(!$row)
print("<font size='1' face='Verdana'>no rows</font>");
else
{
print"$guestdate"; //result Array supposed to be 2008-05-27 06:05:13
}
?>
|
i guess its because datetime datatype. so when i click the button, only word 'Array' written.
i think i have to separate it using explode() function or array_slice() function. but it won't work.
i already check the sql too, and it work. so the problem not in the sql.please, if anybody can give advice.many many thanks. |
|
thexpgeek

Joined: 13 Dec 2007 Posts: 24
|
Posted: Wed May 28, 2008 10:30 am |
|
|
|
I used the following to get a list of usernames contained in a table. You should be able to modify it to get what you need from it.
| Code: |
<form method="post"target="_self">
<?php
include 'connect.php';
mysql_connect($hostname,$username,$password) or die(mysql_error());
mysql_select_db(elnods) or die(mysql_error());
$sqlchar = "SELECT `character` from `tbl_stats`";
$resultchar = mysql_query($sqlchar);
echo "<Select Name=\"charactername\">";
echo "<Option Value=\"$character\">$character</Option>";
echo "<Option Value=\"------------\">------------</Option>";
echo "<Option Value=\"\"></Option>";
while($c=mysql_fetch_array($resultchar)){
echo "<Option Value=\"$c[character]\">$c[character]</Option>";
}
mysql_close();
echo "</select>";
?>
<input type='submit' name='submit' value='Show Stats'>
</form> |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|