Forum Moderators: coopster
<td valign="top">
<?php
$con = mysql_connect("localhost","abc","123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("abc", $con);
$sql="INSERT INTO SHOWS (DATE, TIME, VENUE, TITLE, DESCRIPTION, AGE, COST) VALUES ('$_POST[DATE]','$_POST[TIME]','$_POST[VENUE]','$_POST[TITLE]','$_POST[DESCRIPTION]','$_POST[AGE]','$_POST[COST]')";
if(isset($_POST['TITLE'])) {
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<br><br><b>1 show added to example.com</b>";
}
$result = mysql_query("SELECT * FROM SHOWS ORDER BY ID DESC");
echo "<br><br><table border='0' align='center' cellpadding='3' cellspacing='1' width='85%'>
<tr>
<th>ID</th>
<th>Date</th>
<th>Time</th>
<th>Venue</th>
<th>Title</th>
<th>Description</th>
<th>Age</th>
<th>Admission</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td bgcolor='016111'><font face='Arial' size='1'>" . $row['ID'] . "</font></td>";
echo "<td bgcolor='111111'><font face='Arial' size='1'>" . $row['DATE'] . "</font></td>";
echo "<td bgcolor='111111'><font face='Arial' size='1'>" . $row['TIME'] . "</font></td>";
echo "<td bgcolor='111111'><font face='Arial' size='1'>" . $row['VENUE'] . "</font></td>";
echo "<td bgcolor='111111'><font face='Arial' size='1'>" . $row['TITLE'] . "</font></td>";
echo "<td bgcolor='111111'><font face='Arial' size='1'>" . $row['DESCRIPTION'] . "</font></td>";
echo "<td bgcolor='111111'><font face='Arial' size='1'>" . $row['AGE'] . "</font></td>";
echo "<td bgcolor='111111' align='center'><font face='Arial' size='1'>$" . $row['COST'] . "</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor='00000f' align='right' valign='top' colspan='3'><font face='Arial' size='1'><b>URL:</b></font></td><td colspan='5' bgcolor='00000f'><a href='http://example.com/shows/index.php?id=" . $row['ID'] . "' class='bluelinks'>http://example.com/shows/index.php?id=" . $row['ID'] . "</font><br><br></td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
</td> [edited by: jatar_k at 3:58 pm (utc) on Apr 23, 2010]
[edit reason] removed specifics [/edit]
I will be the only one using the form
$showdate = $row['DATE'];
$query = "select date_format($showdate,'%m/%d/%Y')"; // mm/dd/yyyy
$dt_res = mysql_query("$query");
// There will only be one result.
$dt_row = mysql_fetch_array($dt_res);
// Store it back in $row so you don't have to change anything else
$showdate = $dt_row[0];