Jump to content

Lets see who is the Guru Of All The Gurus


ankycooper

Recommended Posts

hi
i have a form with fields name age gender email.
i want to insert multiple records into a dataase with 1 form

Need some help
Good informative links are welcome

This is my script and i'm trying to insert mutiple data rows with 1 form
[code]<?php
session_start();

if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true || !isset($_SESSION['role']) || $_SESSION['role'] !=="Manager") {
// not logged in, move to login page
header('Location: ../login.php');
exit;
}
include '../config/dbinfo.inc.php';
@mysql_connect($host,$user_name,$pass_word)or die( "Unable to Connect to database");
@mysql_select_db($database) or die( "Unable to select database");

$specialty=$_GET['specialty'];
$mmyy=$_GET['mmyy'];

$query = "SELECT * FROM emp WHERE specialty = '$specialty' and role='Engineer' or specialty = '$specialty' and role='TL-ATL' order by mgr";
$result = mysql_query($query) or die('Error : ' . mysql_error());

if (isset($_POST['sdate*']) && isset($_POST['edate*']) && isset($_POST['now*'])){

function dateconvert($date,$func) {
if ($func == 1){ //insert conversion
list($day, $month, $year) = split('[/.-]', $date);
$date = "$year-$month-$day";
return $date;
}
if ($func == 2){ //output conversion
list($year, $month, $day) = split('[-.]', $date);
$date = "$day/$month/$year";
return $date;
}
}

$specialty=$_GET['specialty'];
$mmyy=$_GET['mmyy'];
$sdate=$_POST['sdate*'];
$sdate=dateconvert($sdate, 1);
$edate=$_POST['edate*'];
$edate=dateconvert($edate, 1);
$now=$_POST['now*'];


while(list($id) = mysq[/code]
What do you need help with?

What doesn't work with the code you have already written?

If you're looking for a 'how do I add information to a database', take a look at the tutorials linked from the home page of phpfreaks.com

Understand the the object of 'help' is help, not 'what can we write for you'  ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.