i try change mysql code to pdo
and make this codes:
<?php
$jds="SELECT tc,tn,tb,tfz,tmz FROM teams WHERE leag='$lig' ORDER BY tmz DESC, tfz DESC, tzade DESC LIMIT 18";
$sth = $conn->prepare($jds);
$sth->execute();
if ($shom = $sth->rowCount() > 0){
$j=0;
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$j++;
if($row['tc'] == $team_id){
?>
some html codes
<?php
}
else{
?> other html codes
but i think have sql injection problem and some problems in $lig
then change to this code: $lig in select --> :lig and execute() --> execute(array(':lig' => $lig))
<?php
$jds="SELECT tc,tn,tb,tfz,tmz FROM teams WHERE leag=:lig ORDER BY tmz DESC, tfz DESC, tzade DESC LIMIT 18";
$sth = $conn->prepare($jds);
$sth->execute(array(':lig' => $lig));
if ($shom = $sth->rowCount() > 0){
$j=0;
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$j++;
if($row['tc'] == $team_id){
?>
but not work
can you help me to make my codes best permorfamnce?
sorry for bad english i am beginner