This code don't work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeva39
Forum Commoner
Posts: 45
Joined: Sun Aug 27, 2006 11:45 pm
Location: Panamá

This code don't work

Post 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
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Post 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
jeva39
Forum Commoner
Posts: 45
Joined: Sun Aug 27, 2006 11:45 pm
Location: Panamá

Post 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...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
jeva39
Forum Commoner
Posts: 45
Joined: Sun Aug 27, 2006 11:45 pm
Location: Panamá

Post by jeva39 »

Thanks
Post Reply