anonīms Posted April 25, 2008 Report Share 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? :\ Link to comment Share on other sites More sharing options...
andrisp Posted April 25, 2008 Report Share 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. Link to comment Share on other sites More sharing options...
marrtins Posted April 25, 2008 Report Share Posted April 25, 2008 un ieskati andrisp kontā kādu aliņu.. quote_smart <-- muhehhehehe Link to comment Share on other sites More sharing options...
bubu Posted April 25, 2008 Report Share Posted April 25, 2008 andrisp: un kas tas ir šis te "or die(mysql_error());" viņa kodā? Link to comment Share on other sites More sharing options...
anonīms Posted April 26, 2008 Author Report Share Posted April 26, 2008 error_reporting man jau ir, bet nesaprotu marrtins rakstīto :\ btw, kverijā vajadzēja likt to visu ` vai ' ? Link to comment Share on other sites More sharing options...
andrisp Posted April 26, 2008 Report Share Posted April 26, 2008 anonīms, ' bubu, jā, nepamanīju. Link to comment Share on other sites More sharing options...
Recommended Posts