i just want to ask how to get my data from another database let say i want to take s_title from medic_subject_offered to put together with another database so that when i debug i can make the s_title appear... because when i search by s_code..all the data will be insert but not the s_title... can you answered me as soon as possible.. thanks
<?php require_once('Connections/mas.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "login.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_mas, $mas);
$query_reg = "SELECT * FROM medic_block_reg";
$reg = mysql_query($query_reg, $mas) or die(mysql_error());
$row_reg = mysql_fetch_assoc($reg);
$totalRows_reg = mysql_num_rows($reg);
mysql_select_db($database_mas, $mas);
$query_name = "SELECT * FROM medic_student";
$name = mysql_query($query_name, $mas) or die(mysql_error());
$row_name = mysql_fetch_assoc($name);
$totalRows_name = mysql_num_rows($name);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>View Record | Medic Assessment System</title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style2 {color: #FFFFFF}
.style3 {color: #333333; }
.style4 {color: #000000}
.style6 {font-size: 14; }
-->
</style>
<script type="text/Javascript">
<!--
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
//-->
</script>
</head>
<body>
<form action="" method="post" name="form1" class="style1" id="form1">
<table width="763" height="24" border="0" align="center">
<tr>
<td bgcolor="#FFFFFF"><p align="center"> </p>
<p align="center" class="style3"><strong>List of Registered Student</strong></p>
<p align="center" class="style3">S_Code:
<input type="text" name="s_code" id="s_code" value="<?php echo $row_reg['s_code']; ?>"/>
</p>
<p align="center" class="style3">S_Title:
<input type="text" name="title" id="title" value="<?php echo $row_a['title']; ?>" />
</p>
<table width="621" border="1" align="center" bordercolor="#99CC00">
<tr>
<td width="84" height="38" bgcolor="#FFFFCC" class="style3"><div align="center" class="style6">Matric No. </div></td>
<td width="94" bgcolor="#FFFFCC" class="style3"><div align="center" class="style6">Name</div></td>
<td width="60" bgcolor="#FFFFCC" class="style3"><div align="center" class="style6">Sessi</div></td>
<td width="52" bgcolor="#FFFFCC" class="style3"><div align="center" class="style6">Year</div></td>
<td width="58" bgcolor="#FFFFCC" class="style3"><div align="center" class="style6">Block</div></td>
<td width="61" bgcolor="#FFFFCC" class="style3"><div align="center" class="style6">Group</div></td>
<td width="63" bgcolor="#FFFFCC" class="style3"><div align="center" class="style6">Status</div></td>
<td width="97" bgcolor="#FFFFCC" class="style3"> </td>
</tr>
<?php do { ?>
<tr>
<td height="27" bgcolor="#CCFFCC" class="style3"><div align="center"> <?php echo $row_reg['matric_no']; ?> </div></td>
<td bgcolor="#CCFFCC" class="style3"><div align="center"><?php echo $row_reg['name']; ?></div></td>
<td bgcolor="#CCFFCC" class="style3"><div align="center"><?php echo $row_reg['sessi']; ?></div></td>
<td bgcolor="#CCFFCC" class="style3"><div align="center"><?php echo $row_reg['year']; ?></div></td>
<td bgcolor="#CCFFCC" class="style3"><div align="center"><?php echo $row_reg['block']; ?></div></td>
<td bgcolor="#CCFFCC" class="style3"><div align="center"><?php echo $row_reg['group']; ?></div></td>
<td bgcolor="#CCFFCC" class="style3"><div align="center"><?php echo $row_reg['status']; ?></div></td>
<td bgcolor="#CCFFCC" class="style3"><div align="center">
<input type="button" name="button" id="button" value="DELETE" />
</div></td>
</tr>
<?php } while ($row_reg = mysql_fetch_assoc($reg)); ?>
</table>
<p align="center"><span class="style2"><span class="style4"> <a href="reg_query.php">Back</a> | <a href="main.php">Module Menu</a> | </span></span><span class="style2"><a href="<?php echo $logoutAction ?>" onclick="MM_popupMsg('You\'re successfully logout from this system...')">Logout</a></span></p>
<p> </p></td>
</tr>
</table>
<p align="center"> </p>
<p align="center"> </p>
<p> </p>
</form>
<EMBED NAME='CS1210513108413' SRC='Windows Notify.wav' LOOP=false
AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0></EMBED>
</body>
</html>
<?php
mysql_free_result($reg);
mysql_free_result($name);
?>

New Topic/Question
Reply




MultiQuote




|