Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: PHP mysql_excape but need to search for those items Date: Tue, 12 Jun 2012 11:26:40 +0200 Organization: A noiseless patient Spider Lines: 69 Message-ID: <4FD70B50.6020408@arnowelzel.de> References: <3c8fad99-d356-4d8c-acfb-a1fe06503254@v9g2000vbc.googlegroups.com> <4ca350b3-d776-42e8-bb87-7c4d0d959a99@d17g2000vbv.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="l9c/A+zTZgD4vXu1XJ7hjg"; logging-data="29093"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+xFIBsDuqVrrIRsbQJYsFfDEwdiQSc/bs=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: <4ca350b3-d776-42e8-bb87-7c4d0d959a99@d17g2000vbv.googlegroups.com> Cancel-Lock: sha1:4ggv5qYrju/WB1USbpO9Whcmczg= Xref: csiph.com comp.lang.php:6301 mrgushi, 11.06.2012 18:48: > Interesting... Thx. > You have any samples codes to give me an idea of how something like > that would work. The JS issue is a fantastic point but not as I assume you can use the mysqli extension and we have a table named "lookuptable" where you want to get a result (id, data) for a specified key, which was passed as GET parameter "key": prepare('SELECT id, data FROM lookuptable WHERE key=?'); if($stmt) { // Bind key parameter as string $stmt->bind_param('s', $_GET['key']); // Execute the statement $stmt->execute(); // Bind the result columns $stmt->bind_result($id, $data); // Fetch the first row from the table if($stmt->fetch()) { echo 'ID: '.$id.', data: '.$data; } // Close the statement $stmt->close(); } // Close the database connection $db->close(); ?> For further information see: Or as an alternative to mysqli you can also use PDO: -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de