Page 1 of 1

This code don't work

Posted: Sun Sep 03, 2006 12:36 pm
by jeva39
I use this codes but don't work

Code: Select all

<?php echo "<a href='to.php?$sort=='clase''>CL</a><br>"?>

Code: Select all

<?php echo "<a href='to.php?$clas=='RO''>RO=Rock</a><br>"?>
Can help me what is wrong?

Thanks in advanced

Posted: Sun Sep 03, 2006 1:03 pm
by php3ch0

Code: Select all

<?php echo "<a href='to.php?clas=RO'>RO=Rock</a><br>"; ?>
i do not know if you need $clas needs to be dynamic

Posted: Sun Sep 03, 2006 1:29 pm
by jeva39
Thanks but don't work. The syntax and the use of the quotes is correct as I write in above codes?.

I think if the real cause of the problem is in the query that I use:

Code: Select all

$tipo=$HTTP_GET_VARS['$clas'];
if ($tipo = "TO"){
$sql= "select id,clase,tema,ritmo,autor,arreglo,fecha,kar,nuevo,archivo from temas order by $sort";
}else{
$sql= "select id,clase,tema,ritmo,autor,arreglo,fecha,kar,nuevo,archivo from temas where CLASE like '%" & $tipo & "%' order by $sort";
}

Thanks again...

Posted: Sun Sep 03, 2006 1:36 pm
by feyd

Code: Select all

echo '<a href="to.php?clas=RO">RO=Rock</a>';

Code: Select all

$tipo = $_GET['clas'];
if ($tipo != 'RO'){
  $sql = 'select id,clase,tema,ritmo,autor,arreglo,fecha,kar,nuevo,archivo from temas order by ' . $sort;
}else{
  $sql = 'select id,clase,tema,ritmo,autor,arreglo,fecha,kar,nuevo,archivo from temas where CLASE like \'%RO%\' order by ' . $sort;
}
Be careful about allowing users to inject information into your queries.

Posted: Sun Sep 03, 2006 5:09 pm
by jeva39
Thanks