Jump to content

raytravel

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by raytravel

  1. This finally worked: <?php for ($x = 0; $x < 131 ;$x++) { $ZZ = $_POST["z".$x]; if ($ZZ != '') {echo $x.' = '.$ZZ.'<br>'; $sql='UPDATE photo01 SET PhotoText = ? WHERE id = ?'; $PhotoText = $ZZ; $id_equal_to = $x; /* Prepare statement */ $stmt = $conn->prepare($sql); if($stmt === false) { trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR); } /* Bind parameters. TYpes: s = string, i = integer, d = double, b = blob */ $stmt->bind_param('si',$PhotoText,$id_equal_to); /* Execute statement */ $stmt->execute(); $stmt->close(); } } ?>
  2. I wrote a simple mysql record update. mysqli_query($link, "UPDATE photo01 SET PhotoText='abcd' WHERE id= '1' "); Work fine until I use a variable: mysqli_query($link, "UPDATE photo01 SET PhotoText= $ZZ WHERE id= $x "); If $ZZ contains only number it updated the cell. ANY letters does not. The cell is text and standard US ASCII I tried: mysqli_query($link, "UPDATE photo01 SET PhotoText={$ZZ} WHERE id={$x}"); same problem Here is my loop: <?php for ($x = 0; $x < 131 ;$x++) { $ZZ = $_POST["z".$x]; if ($ZZ != '') { mysqli_query($link, "UPDATE photo01 SET PhotoText={$ZZ} WHERE id={$x}"); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.