Last foreach change

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 17, 2023   (RSS)

Solved

<?php foreach ($asignaturasRecords as $record): ?>
      <?php $num = $record["num"]; ?>
	  <?php echo "('" . $_POST["createdDate_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["createdByUserNum_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["updatedDate_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["updatedByUserNum_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["curp_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["claveasignatura_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["ciclo_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["calificacion_$num"] . "',"; ?>
	  <?php echo "'" . $_POST["idobservaciones_$num"] . "";
   if ($contar++ == $count - 1) {
       echo "');";
   } else {
       echo "'),";
   }
   ?>

Solved

By Dave - March 17, 2023

Hi Alan,

Glad you got it working!  If you're inserting form data into MySQL be sure to escape your inputs.  We have a helper function mysql_escape() for that.  

Dave Edis - Senior Developer
interactivetools.com