anonīms Posted April 25, 2008 Report Posted April 25, 2008 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 ''komandas' WHERE LIKE.. if(isset($_POST['meklet'])) { $meklet = quote_smart($_POST['meklet']); $tabula = quote_smart($_POST['tabula']); if($tabula == 'lietotaji') { $kas = 'lietotajvards'; } elseif($tabula == 'komandas') { $kas = 'komandas_nosaukums'; } else { $kas == 'raksts_visraksts'; } $mekletajs = mysql_query("SELECT * FROM $tabula WHERE $kas LIKE $meklet") or die(mysql_error()); while($atrasts = mysql_fetch_array($mekletajs)) { } echo "SELECT * FROM $tabula WHERE $kas LIKE $meklet"; echo "<br /><br />BETA!"; } else { echo ' <form method="post" action="search.php"> <select name="tabula"> <option value=\'jaunumi\'>'.$lang['izvelne_jaunumi'].' <option value=\'lietotaji\'>'.$lang['profils_lietotaji'].' <option value=\'komandas\'>'.$lang['komandas_komandas'].' </select><br /> <input type="text" name="meklet" /><br /> <input type="submit" value="'.$lang['meklet'].'" /> </form>'; } Kas par vainu? :\
andrisp Posted April 25, 2008 Report Posted April 25, 2008 $meklet ieliec iekš pēdiņām. Un tā kā izmanto LIKE, tad pieļauju, ka gribēsi LIKE '%$meklet%' Bet vispār vajag mysql_error() izmantot, lai noteiktu, kas kverijam par vainu.
marrtins Posted April 25, 2008 Report Posted April 25, 2008 un ieskati andrisp kontā kādu aliņu.. quote_smart <-- muhehhehehe
bubu Posted April 25, 2008 Report Posted April 25, 2008 andrisp: un kas tas ir šis te "or die(mysql_error());" viņa kodā?
anonīms Posted April 26, 2008 Author Report Posted April 26, 2008 error_reporting man jau ir, bet nesaprotu marrtins rakstīto :\ btw, kverijā vajadzēja likt to visu ` vai ' ?
Recommended Posts