Add Publication

[insert_php]

if (!isset($_SESSION)) {
session_start();
}

# FileName=”Connection_pdo_mysql.htm”
# Type=”MYSQL”
# HTTP=”true”
$hostname = “mysql1005.mochahost.com”;
$database = “fosco1_foscopa”;
$username = “fosco1_wp527”;
$password = “S82..2qi9p”;
$connStr = ‘mysql:host=mysql1005.mochahost.com;dbname=fosco1_foscopa’;
$user = ‘fosco1_wp527’;
$pass = ‘S82..2qi9p’;
//set_exception_handler(‘exceptionHandler’);
try
{
$conn = new PDO($connStr, $user, $pass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
showError(“Sorry, an error has occurred. Please try your request
later\n” . $e->getMessage());
}

if ((isset($_POST[“MM_insert”])) && ($_POST[“MM_insert”] == “MM_insert”)) {
$added=date(‘d-m-Y’);

$sql_insert = “INSERT INTO articles (f_title, f_abstract, f_journal, f_year, f_date_added, f_volume, f_issue, f_pages) VALUES (:id1, :id2, :id3, :id4, ‘$added’, :id5, :id6, :id7)”;
$sqlinsert=$conn->prepare($sql_insert);
$sqlinsert->bindParam(‘:id1’, ($_POST[‘f_title’]));
$sqlinsert->bindParam(‘:id2’, ($_POST[‘f_abstract’]));
$sqlinsert->bindParam(‘:id3’, ($_POST[‘f_journal’]));
$sqlinsert->bindParam(‘:id4’, ($_POST[‘f_year’]));
$sqlinsert->bindParam(‘:id5’, ($_POST[‘f_volume’]));
$sqlinsert->bindParam(‘:id6’, ($_POST[‘f_issue’]));
$sqlinsert->bindParam(‘:id7’, ($_POST[‘f_pages’]));

$result=$sqlinsert->execute();

$articleid = $conn->query(“SELECT f_articleid FROM articles WHERE f_title='”.$_POST[‘f_title’].”‘ and f_year='”.$_POST[‘f_year’].”‘ and f_journal='”.$_POST[‘f_journal’].”‘ “);
$articleid->setFetchMode(PDO::FETCH_ASSOC);
$row_articleid=$articleid->fetch();
$aid=$row_articleid[‘f_articleid’];

$count=count($_POST[‘f_author’]);

for($i=0;$i<$count;$i++){ $aid=$row_articleid['f_articleid']; if(!(empty($_POST['f_author']))){ $sql_insert2 = "INSERT INTO authors (f_author, f_affiliation, f_articleid) VALUES (:id1, :id2, '$aid')"; $sqlinsert2=$conn->prepare($sql_insert2);
$sqlinsert2->bindParam(‘:id1’, ($_POST[‘f_author’][$i]));
$sqlinsert2->bindParam(‘:id2’, ($_POST[‘f_affiliation’][$i]));

$result=$sqlinsert2->execute();
}
}
}
[/insert_php]

Add Article

Meta

Author(s)

Year

Article

Title

Journal



Abstract