Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][SQL][MySQL]prepare & mysqli
eminiasty
post
Post #1





Grupa: Zarejestrowani
Postów: 267
Pomógł: 0
Dołączył: 11.09.2015

Ostrzeżenie: (0%)
-----


Czy poniższy kod da się jakoś uprościć i czy w ogóle jest poprawny?
  1. $value ='1';
  2.  
  3. $stmt = $link->prepare("SELECT id FROM " . $db_prefix . "test WHERE id = ?");
  4.  
  5.  
  6. $stmt->bind_param('i', $value);
  7.  
  8. if($stmt->execute()) {
  9.  
  10. $result = $stmt->get_result();
  11.  
  12. while ($row = $result->fetch_assoc()) {
  13.  
  14. echo $row['id'];
  15.  
  16. }
  17.  
  18. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 11:32