Can you tell me how to PROPERLY close this mySQL session? I seem to be leaving the sessions open and causing some problems.
<?php
function db_connect()
{
$result = @mysql_pconnect("localhost", "user", "pass");
if (!$result)
return false;
if (!@mysql_select_db("db"))
return false;
return $result;
}
$conn = db_connect();
$sql = "select * from ocuca_cars
where cu = 'FECU'
order by cu asc";
$result = mysql_query($sql, $conn);
print "$story[headline]";
print "</div>";
print "<a name=skip>";
print "$story[headline]";
while ($story = mysql_fetch_array($result)) {
print "<H1>".$story[year]."
".$story[model]."
".$story[make]."</H1>"
if ($story[picture]) {
$width = 135;
$height = 100;
print "<p>";
print "<a href=";
print "$story[picture]";
print ">";
print "<IMG SRC=";
print "$story[picture] ";
print "HEIGHT=$height WIDTH=$width ALIGN=LEFT border=0></a></p>";
}
print "<p>Price: ";
echo nl2br ($story[price]);
print "</p>";
print "<p>Miles: ";
echo nl2br ($story[miles]);
print "</p>";
print "<p>Other Details: ";
echo nl2br ($story[details]);
print "</p>";
mysql_close($db_connect);
}
?>