Skip to content

Commit

Permalink
corretti errori
Browse files Browse the repository at this point in the history
  • Loading branch information
martiele committed Dec 22, 2022
1 parent 880d619 commit 9725473
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
31 changes: 16 additions & 15 deletions cappelli_edoardo/php-pdo-crud-vuoto copy/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,22 @@
$id_post = (int)$_GET["id"];
echo "l'ho letto";

$sql ="SELECT * FROM post WHERE id=?";
$result = $conn->prepare($sql);
$result->execute($id_post);
$sql ="SELECT * FROM post WHERE id=?";
$result = $conn->prepare($sql);
$result->execute($id_post);


if ($result->rowCount() > 0) {
// se voglio “ciclare” tutti i risultati posso farlo così:
$row = $result->fetch(PDO::FETCH_ASSOC);
}else{
header("location:index.php");
exit();
if ($result->rowCount() > 0) {
// se voglio “ciclare” tutti i risultati posso farlo così:
$row = $result->fetch(PDO::FETCH_ASSOC);
}else{
header("location:index.php");
exit();
}
}


?>
<html>
<head>
<title>PHP PDO CRUD - Modifica Record</title>
<style>
Expand All @@ -79,20 +80,20 @@

<div class="demo-form-row">
<label>Title: </label><br>
<input type="text" name="post_title" class="demo-form-field" value="<?=row["post_title"]?>" required />
<input type="text" name="post_title" class="demo-form-field" value="<?=$row["post_title"]?>" required />
</div>
<div class="demo-form-row">
<label>Description: </label><br>
<textarea name="description" class="demo-form-field" rows="5" required ><?=row["description"]?></textarea>
<textarea name="description" class="demo-form-field" rows="5" required ><?=$row["description"]?></textarea>
</div>
<div class="demo-form-row">
<label>Date: </label><br>
<input type="date" name="post_at" class="demo-form-field" value="<?=row["post_at"]?>" required />
<input type="date" name="post_at" class="demo-form-field" value="<?=$row["post_at"]?>" required />
</div>
<div class="demo-form-row">
<input name="save_record" type="submit" value="<?=row["save_record"]?>" class="demo-form-submit">
<input name="save_record" type="submit" value="<?=$row["save_record"]?>" class="demo-form-submit">
</div>
</form>
</form>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion francesco_pietropaolo/1-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//LA VARIABILE DEVE ESSERE UNA VARIABILE "SEMPLICE"

echo "Messaggio: $var_msg <br />";
echo "Interessi: $elenco_interessi"
echo "Interessi: $elenco_interessi";

$destinatario = "";

Expand Down
2 changes: 1 addition & 1 deletion francesco_pietropaolo/php-pdo-crud-vuoto/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</thead>
<tbody id="table-body">

<?php/*
<?php /*
//prima devo aver aperto la connessione al db TABELLA POSTS
$sql = "SELECT * FROM posts ORDER BY post_at DESC, id DESC";
$result = $conn->prepare($sql);
Expand Down

0 comments on commit 9725473

Please sign in to comment.