Having major problems trying to use a function library. it will be more complex then the code I provide but I am confident that when we figure out what is going on here the other functions I write in the library will work out too.
first of alll couple of questions
a)Can I store multiple functions inside of on php file?
b)is this html right for calling the functions?
c)is the syntax correct for the function file.
B:
[code=html]
<?
include (“listingsfunc.php”);
dbconnect();
eventreg();
?>
<html>
<head></head><body><table><tr>
<td id=”rh-col”>
<h2 align=”center”><a name=”top”>The Official Erie Bar, Erie Club, <br />
and Erie Event Head Quarters</a></h2>
<hr align=”center” width=”75%” />
<br/>
<hr align=”center” width=”75%” />
<h3 align=”center”><a name=”level2″>Event Announcements</a></h3>
<hr align=”center” width=”75%” />
<? echo “$display_block”; ?>
<br />
<br />
</td>
</tr>
</table>
</body>
</html>
C:
[code=php]<?php
//connects to my database for future querys
function dbconnect() {
$db_name = “markbad_markbadsql”;
$connection = @mysql_connect (“localhost”, “markbad_drpl1”, “pwremoved”)
or die (‘I cannot connect to the database because: ‘ . mysql_error());
$db = mysql_select_db ($db_name, $connection)
or die (‘I cannot connect to the database because: ‘ . mysql_error());
}
// Shows a regular listing of events from the past week.
function eventreg() {
$table_name = “events”;
$sql = “SELECT * FROM $table_name WHERE `date` BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 DAY) and DATE_ADD(CURDATE(), INTERVAL 1 DAY)”;
$result = mysql_query($sql,$connection)
or die (mysql_error());
//While loop will create an array called $row
while ($row = mysql_fetch_array($result)) {
// get individual elements from events
$date = ($row[‘date’]);
$bar = ($row[‘bar’]);
$updated = ($row[‘updated’]);
$details = ($row[‘details’]);
$map_url = ($row[‘map_url’]);
$display_block .= ”
<h4>$bar <span class=”date”> $updated</span></h4>
<p>$details</p>
<div align=”right”><span class=”map”><a href=”$map_url” target=”_blank” title=”Erie Bar :: $bar”>Get Directions</a></span></div>
“;
}
}
?>
Please Help Me My whole site is down until I get this resolved!!
Thank you.