mysql tabel virker ikke i joomla
Jeg har lavet et script der laver en tabel med data fra en mysql database, og det virkede egentligt fint. Men nu hvor jeg prøver at lave scriptet om til et joomla modul, virker det pludseligt ikke.Koden:
<?php
$update = $address = JRequest::getVar('up', '', 'post');
if(isset($up)){
$hello = modHelloWorldHelper::getHello( $update );
echo $hello;
}
$border = $address = JRequest::getVar('order', '', 'get');
if(isset($border)){
$order = $border;
}else{
$order = "torder";}
$data = $address = JRequest::getVar('data', '', 'get');
$col = $address = JRequest::getVar('col', '', 'get');
echo $col;
echo $data;
if($col=="hjemmehold"){
$list = "WHERE $col='$data' OR udehold='$data'";
}
else {
if( isset($data)){
$list = "WHERE $col='$data'";}
else{ $list = NULL; }
}
// Make a MySQL Connection
mysql_connect("sivarajah.dk.mysql", "sivarajah_dk", "juventus") or die(mysql_error());
mysql_select_db("sivarajah_dk") or die(mysql_error());
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM kkp0910 $list ORDER BY $order")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th><a href=\"{$PHP_SELF}?order=knr\">Kampnummer</a></th> <th><a href=\"{$PHP_SELF}?order=turnering\">Turnering</a></th> <th><a href=\"{$PHP_SELF}?order=runde\">Runde</a></th> <th>Kamp</th> <th><a href=\"{$PHP_SELF}?order=torder\">Tidspunkt</a></th> <th>resultat</th> <th>Opdater</th></tr>";
while ($row = mysql_fetch_array( $result ))
{
echo "<tr><td>";
echo "<a href=\"{$PHP_SELF}?col=knr&data={$row['knr']}\">{$row['knr']}</a>";
echo "</td><td>";
echo '<a href="'.$PHP_SELF.'?col=turnering&data='.$row['turnering'].'">'.$row['turnering'].'</a>';
echo "</td><td>";
echo '<a href="'.$PHP_SELF.'?col=runde&data='.$row['runde'].'">'.$row['runde'].'</a>';
echo "</td><td>";
echo "<a href=\"{$PHP_SELF}?col=hjemmehold&data={$row['hjemmehold']}\">{$row['hjemmehold']}</a> - <a href=\"{$PHP_SELF}?col=hjemmehold&data={$row['udehold']}\">{$row['udehold']}</a>";
echo "</td><td>";
echo $row['tidspunkt'];
echo "</td><td>";
echo $row['resultat'];
echo "</td><td>";
echo "<a href=\"{$PHP_SELF}?up=true&dataup={$row['knr']}\">UD</a>";
echo "</td></tr>";
}
echo "</table>";
class modHelloWorldHelper
{
function getHello( $update )
{
// Make a MySQL Connection
mysql_connect("sivarajah.dk.mysql", "sivarajah_dk", "juventus") or die(mysql_error());
mysql_select_db("sivarajah_dk") or die(mysql_error());
$result = mysql_query("SELECT orgurl FROM kkp0910 WHERE knr='$update'")
or die(mysql_error());
$orgurl = mysql_fetch_array( $result );
echo $orgurl['orgurl'];
//$raw = file_get_contents($orgurl['orgurl']);
$newlines = array("\t","\n","\r","\x20\x20","\0","\x0B");
$content = str_replace($newlines, "", html_entity_decode($raw));
$start = strpos($content,'<table cellspacing="0" class="dbustandard stripes srDefault srMatchInformation">');
$end = strpos($content,'</table>',$start);
$table = substr($content,$start,$end-$start);
preg_match_all("|<td class=\"c02\"(.*)</tr>|U",$table,$rows);
$tidraw = $rows[0][4];
$resraw = $rows[0][8];
$tid = strip_tags($tidraw);
$res = strip_tags($resraw);
// Insert a row of information into the table "example"
$example = mysql_query("UPDATE kkp0910 SET tidspunkt='$tid', resultat='$res' WHERE knr='$update'")
or die(mysql_error());
return "Data Inserted!";
}
}
?>
Som det kan ses, så bruger jeg jrequest i stedet for $_GET, men det burde vel ikke være et problem?
Fejlen lyder således:
"Data Inserted!You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='' ORDER BY' at line 1"
Håber der er en der kan hjælpe mig.
