I've put together a few functions to run SQL queries for me, to reduce clutter. The first one, an INSERT function, works fine. Took a little bit to figure out the whole single/double quote issue, but I got it. Now, I have come to the SELECT function. It doesn't work. No errors, no nothing, it just won't work. It display's nothing. I have spent 4 days and 30+ look-over's of it, but it makes perfect sense to me and my ellow coder. Here it is:
In the Config File
// Funtions - SELECT from Database
function db_select($from_where, $extra_query, $die_msg)
{
$result = @mysql_query("SELECT * FROM $from_where $extra_query") or die ($die_msg.mysql_error());
return $result;
}
In the Other File
$from = "lll_changelog";
$extras = "";
$die = "Error during Select.<br>";
db_select($from, $extras, $die);
while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td style="padding: 2px;"><p><a href="" rel="changelog">' . $row['idea_name'] . '</a></p></td>';
echo '<td width="150px" align="center" style="padding: 2px;"><p>' . $row['sparked'] . '</p></td>';
echo '<td width="150px" align="center" style="padding: 2px;"><p>' . never($row['started']) . $thedate . '</p></td>';
echo '<td width="150px" align="center" style="padding: 2px;"><p>' . never($row['completed']) . $thedate . '</p></td>';
echo '<td width="150px" align="center" style="padding: 2px;"><p>' . never($row['last_updated']) . $thedate . '</p></td>';
echo '<td width="150px" align="right" style="padding: 2px;"><p>' . $row['coders'] . '</p></td>';
echo '</tr>';
} ?>
If I put what is in the function, above what I have there as shown in the file, it works perfectly fine.. so that means there is either a problem with the sending, recieving, or returning of the function. Help would be much appreciated.