[thelist] using URL's to update mysql db

Mark Mckee lists at soddengecko.com
Fri Oct 27 20:09:37 CDT 2006


hi all

I am writing a small templating instruction and so far have everything
working neatly. I have a few queries I would like to run by you guys as
I'm having trouble finding the answer, I have looked in the usual places
and found nothing that helps.

each template sits in its own folder i.e.. themes/template1 or
themes/default. I am using a mysql row to define the template, which is
set at default to begin with and is outputted like so

-----------------------------------------------
function gl_header()
{

$sql = 'SELECT * FROM theme;';
$result = mysql_query($sql) or die('');
while ($row = mysql_fetch_assoc($result)){

$filename = "themes/".$row['theme']."";

if (file_exists($filename)) {
include "themes/".$row['theme']."/header.php";
} else {
include "themes/default/header.php";
}
}
}
-----------------------------------------------

this is where I'm getting slightly stuck. I have a small script that
will read the folder names from the template directory and output the
folder name as a url

-----------------------------------------------
function gl_themechooser()
{
$handle=opendir('./themes');

while ($file = readdir($handle)) {
if ($file != "." && $file != ".." && $file="<a href=\"$file\">$file</a>\n")
{
echo ".$file.";
}
}
closedir($handle);
}
-----------------------------------------------

I would like to know how to make this url update the mysql row when
clicked. I tried outputting them into a drop down box but a separate box
was created for each folder in the template directory and ii was unable
to solve this. any pointers on that would be great.

Thanks in advance

Mark M...



More information about the thelist mailing list