Show sub-data in each data with php - php

I'm trying to solv this issue. I have this php code.
<?php
if (count($Modulos)>0){
for ($x=0; $x<count($Modulos); $x++){
// SOME CODE, to define variables
$controller = 1;
require_once "../controller/moduloController.php";
for ($z=0; $z<count($ActividadesMOD); $z++){
echo $ActividadesMOD[$z]['actividad']. "<br/>";
}
?>
<tr height="35">
<td align="center"> <strong><?php echo $modulo;?> </strong></td>
<td align="center"> <?php echo $encargado[0];?> </td>
<td align="center" valign="middle"> <?php echo $deadline;?>
<a href="javascript:VerDeadline(<?php echo $idmodulo;?>, '4','<?php echo $deadline;?>', '<?php echo $modulo;?>', '<?php echo $finalizado;?>')" onClick="">
<img src="../img/zoom-icon.png" width="17" height="17" align="absbottom">
</a>
</td>
<td align="center"> <strong> <?php echo $avance . " %";?></strong></td>
<td align="center"> <img src="<?php echo $img;?>" width="28" height="15" title="<?php echo $ttl;?>" /> </td>
<td width="7%" align="center"> </td>
</tr>
<?php }
} else { ?>
<tr height="30" style="font-size:11px" >
<td align="center" colspan="5"> [ NO HAY REGISTROS ] </td>
</tr>
<?php } ?>
Result:
Now, each MODULO has ACTIVIDADES (activities) that i need to show below it.
In the image above, it displays the ACTIVITIES from the MODULO 1 and not the other ones.
Taking the example from other page, should be like this:

I got it !!
Changing the require_once for include.
The result with some css:
Greetings.

Related

EXIF image in php

I have a page that image gets uploaded to but the image are not the right way.
I know I need to use EXIF but I am new to this and lost where to start on this as it is in a while loop
can any one help me
thx jason
here is my code
<section class ="box_1">
<form id="evaluations" method="post" action="comments_page_add.php" enctype="multipart/form-data">`enter code here`
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Parent Entered</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td>
</tr>
<?php
while($rows = mysqli_fetch_array($results2)){
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="child[]" type="checkbox" id="child[]" value="<?PHP echo $rows['id']; ?>"></td>
<td bgcolor="#FFFFFF"><?php echo $rows['given_name']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['surname']; ?></td>
</tr>
<?php
}
?>
</table>
</section>
<section class ="box_3">
<?php
while($rows2 = mysqli_fetch_array($results3)){
?>
<table width="100%" border="2" bgcolor="#CCCCCC">
<tr>
<tr><td colspan="4" align="center"><img src='<?php echo $rows2['Photo_parth']; ?>' width='60%' height='150em'></td></tr>
<td align="center" bgcolor="#FFFFFF"><input name="image[]" type="checkbox" id="image[]" value="<?PHP echo $rows2['id']; ?>"></td>
<td bgcolor="#FFFFFF"><?php echo $rows2['id']; ?></td></tr>
<td bgcolor="#FFFFFF"><?php echo $rows2['date']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows2['time']; ?></td>
</tr>
</table>
<?php
}
?>
</table>
</section>

Syntax Error on my php script

I am getting this error message when run the code below. Below is the code that is giving me error messages. This is the error message
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\jq\fines\admin\portal.php on line 218
My code:
<body class="easyui-layout">
<div region="north" class="title" border="false" style="height:40px;">
Client Services Admin Portal
</div>
<div region="center" border="false">
<div id="pp" style="position:relative">
<div style="width:30%;">
<div title="Time" style="text-align:center;background:#f3eeaf;height:170px;padding:5px;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100" height="100">
<param name="movie" value="http://www.respectsoft.com/onlineclock/analog.swf">
<param name=quality value=high>
<param name="wmode" value="transparent">
<embed src="http://www.respectsoft.com/onlineclock/analog.swf" width="100" height="100" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
</object>
</div>
<div title="Current Users Logged On" collapsible="true" closable="false" style="height:250px;padding:3px;">
<center>
<?php require_once "fines/admin/usersloggedon.php"; ?>
</center>
</div>
</div>
<div style="width:70%;">
<div title="Search for receipt" closable="false" style="height:170px;padding:10px;">
<center>
<form action="" method="post" id="receiptnumSearch">
<input type="hidden" name="check" value="submitted">
<input class="easyui-searchbox" style="width:200px" name="receiptnum" data-options="prompt:'',searcher:doReceiptSearch">
</form>
<br/>
<div style="background-color:#3FF; height:1px"> </div><br/>
<?php
require_once"functions.php";
if($_POST['check']=='submitted')//open1
{
//checking for errors
$receiptnum=trim($_POST['receiptnum']);
if($receiptnum=='')//open
{
//System error
echo SysError('Search field empty', 'index.php?t='.urlencode(base64_encode("admin_fins")).'&o='.md5(date('Y-m-d : t')).'');
die();
}//closed
elseif(!empty($receiptnum))//open
{
?><table class='tablestyle2' width=95% cellpadding=2 cellspacing=0>
<tr valign=top>
<td ><table width="100%" border="0" cellspacing="0" cellpadding="0" class='tablestyle_inner'>
<tr>
<td width="40%" class='tableheader' height="25">Paid From Library</td>
<td width="30%" class='tableheader'>Patron Name</td><td width="30%" class='tableheader'>Receipt Number</td>
</tr>
<?php
$db1w = new PDO('mysql:host=10.40.254.229;dbname=koha_msulibrary;charset=utf8', 'root', 'philly');
$gt_r=$db1w->query("SELECT * FROM fine, borrowers,branch_libs where borrowers.cardnumber=fine.cardnumber AND branch_libs.brunchid=fine.brunchid AND fine.receiptNum='$receiptnum' LIMIT 0,1");
$gt_r_results=$gt_r->fetch(PDO::FETCH_ASSOC);
echo'
<tr>
<td class=\'label\' height="25" align="center">'.$gt_r_results['branch_name'].'</td>
<td class=\'label\' align="center">'.ucwords(strtolower($gt_r_results['firstname'].' '.$gt_r_results['surname'])).'</td>
<td class=\'label\' align="center"><a target="_blank" href="http://www.msu.ac.zw/libraries/jq/fines/receipt.php?invoice='.base64_encode('invoce_view').'&t='.base64_encode($gt_r_results['receiptNum']).'">'.$gt_r_results['receiptNum'].'</a></td>
</tr>';
?>
</table></td></tr></table>
<?
}//closed
}//closed
?>
</center>
</div>
<div title="Library Fines Statistics" closable="false" style="height:250px;text-align:center;">
<center>
<br/><form action="" id="date_range" method="post"><table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39%"><input type="hidden" name="date_r" value="date_r"><input name="data1" class="easyui-datebox" value="Start Date" width="200px"></input></td>
<td width="37%"><input name="data2" class="easyui-datebox" value="End Date" width="200px"></input></td>
<td width="24%">View Fines</td>
</tr>
</table></form>
<br/>
<?php
$data1=$_POST['data1'];
$data2=$_POST['data2'];
$date_r=$_POST['date_r'];
$dat=date('Y-m-d');
$da_1=strtotime($data1);
$data_=date('Y-m-d',$da_1);
//$da_2=strtotime($data2_);
//$data2=date('Y-m-d',$da_2);
//checking if date is real date
if((!isRealDate($data1) or !isRealDate($data2) or $dat < $data_ ) and $date_r=='date_r')
{
echo SysError('Incorrect date range', 'index.php?t='.urlencode(base64_encode("admin_fins")).'&o='.md5(date('Y-m-d : t')).'');
die();
}
//end of check
else{
?>
<table width=95% height="125" cellpadding=2 cellspacing=0 class='tablestyle2'>
<tr valign=top><td ><table width="100%" height="122" border="0" cellpadding="0" cellspacing="0" class='tablestyle_inner'> <tr> <td width="50%" class='tableheader' height="19">Branch Library</td> <td width="50%" class='tableheader'>
<?php
if($date_r=='date_r')
{
echo 'Fine collected between '.$data1.' and '.$data2;
}
else
{
echo 'Fines Collected to Date';
}
?></td>
</tr>
<tr>
<td class='label' height="12" >Batanai Library</td>
<td class='label' style="padding-left:10px">
<?php //checking if the date is real
if($date_r!='date_r')
{
echo GETbranchlibs('2');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'2');
}
?></td>
</tr>
<tr>
<td class='label' height="6">GSBL</td>
<td class='label' style="padding-left:10px">
<?php
if($date_r!='date_r')
{
echo GETbranchlibs('3');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'3');
}
?></td>
</tr>
<tr>
<td class='label' height="3" >Law Library</td>
<td class='label' style="padding-left:10px"><?php
if($date_r!='date_r')
{
echo GETbranchlibs('4');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'4');
}
?></td>
</tr>
<tr>
<td class='label' height="3" >Main Library</td>
<td class='label' style="padding-left:10px"><?php
if($date_r!='date_r')
{
echo GETbranchlibs('1');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,1);
}
?></td>
</tr>
<tr>
<td class='label' height="2" >Total</td>
<td class='label' style="padding-left:10px; font-weight:bold;"><u><?php
if($date_r!='date_r')
{
echo GETbranchlibs('0');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'0');
}
}
?></u></td>
</tr>
</table></td></tr></table></center>
</div>
</div>
</div>
</div>
You wrote somewhere in there
<? instead of <?php
So just change that and it will work. Tested on http://www.compileonline.com/execute_php_online.php

PHP - How to Display Detail Record Fields In Another Browser Window From A ListView

I have a ListView produce via PHP code:
<?php do { ?>
<tr>
<td width="20"> <img src="./images/small_pencil.png" /></td>
<td width="20"> <img src="./images/small_eye2.png" /></td>
<td width="20">
<form name="properties" method="post" action="properties.php?search=<?php echo $row_rsProperties['ms_address']; ?>">
<button type="submit" name="properties"> <img src="./images/newsletter.png" /> </button>
</form>
</td>
<td width="250"><?php echo $row_rsProperties['ms_address']; ?></td>
<td width="140"><?php echo $row_rsProperties['ms_city']; ?></td>
<td width="140"><?php echo $row_rsProperties['ms_state']; ?></td>
<td width="60" align="center"><?php echo $row_rsProperties['ms_zip']; ?></td>
<td width="250"><?php echo $row_rsProperties['ms_mm_owner1']; ?></td>
<td width="250" align="center"><?php echo $row_rsProperties['owner_phone1']; ?></td>
<td width="250" align="center"><?php echo $row_rsProperties['expired']; ?></td>
<td width="250" align="center"><?php echo $row_rsProperties['fsbo']; ?></td>
<td width="250" align="center"><?php echo $row_rsProperties['ms_status']; ?></td>
</tr>
<?php } while ($row_rsProperties = mysql_fetch_assoc($rsProperties)); ?>
How would I get the click on the Edit or View anchors to open in a window (that was opened via javascript code after authentication?
PHP file (performed when the main menu is loaded):
<body onLoad="openDetailWindow()">
Javascript src .js file function:
function openDetailWindow() {
window.open("_blank.php","LMS - Record Detail","fullscreen=0,menubar=0","false");
}
Placed the following code inside of the anchor tag:
onclick="window.open(this.href, 'LMS - Record Detail',
'menubar=0,scrollbars=1,toolbar=0', 'false'); return false;"
So, now the tag now reads as follows:
<td width="20"><a href="edit_property_mktg.php?recID=<?php echo $row_rsProperties['recID']; ?>" onclick="window.open(this.href, 'LMS - Record Detail',
'menubar=0,scrollbars=1,toolbar=0', 'false'); return false;"> <img src="./images/small_pencil.png" /></a></td>

Only first row from sql query is displaying

My trying to show product desc in pop up. Mean when i click on product link then one pop up will open and show product desc. but here something is wrong. every product link showing first product desc. My code is Below. Please help me out.
Javascript:
<script language="JavaScript">
function displayPopup(alert_MSG)
{
var theDetail = document.getElementById('flyBox');
theDetail.style.display="block";
}
function closePopup(alert_MSG)
{
var theDetail = document.getElementById('flyBox');
if (theDetail.style.display=="block")
{
theDetail.style.display="none";
}
}
</script>
HTML:
View larger
<div id="flyBox" style="display:none;">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="borderWindow">
<div class="container">
<div id="closeButton"><img src="http://i1122.photobucket.com/albums/l523/Long_Islander/flyBoxClose.png" width="28" height="28" alt="Close Button" border="0" /></div>
<div class="content">
<table width="600" border="0" cellspacing="20" cellpadding="0">
<tr>
<td>
<div id="myMessageBox" name="myMessageBox">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td class="colheadingL"><font color="white">Description</font></td>
</tr>
<tr>
<td ><?php echo $img; ?></td>
<td>Book Name:</td>
<td ><?php echo $row['pname']; ?></td>
<td class="text1">MRP:</td>
<td><?php echo $row['price'];?> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
But pop up is open click on hyperlink. but problem is showing only 1'st record in all product
You don't have loop any in your template script, that is why you see just one record vizualized.
I don't know exactly how your code is organized outside of the snippet you have posted, but assuming your data rows are in $rows array variable, the code will look something like that:
<? foreach($rows as $row) { ?>
<tr>
<td ><?php echo $img; ?></td>
<td>Book Name:</td>
<td ><?php echo $row['pname']; ?></td>
<td class="text1">MRP:</td>
<td><?php echo $row['price'];?> </td>
</tr>
<? } ?>
Try to make IDs of each DIV as Unique.
Below is the sample code, try to use it as per your requirement
<script language="JavaScript">
function displayPopup(id)
{
var theDetail = document.getElementById(id);
theDetail.style.display="block";
}
function closePopup(id)
{
var theDetail = document.getElementById(id);
if (theDetail.style.display=="block")
{
theDetail.style.display="none";
}
}
</script>
<?php for($i=0;$i<4;$i++){?>
<div>
View larger
<div id="flyBox_<?php echo $i;?>" style="display:none;">
<div id="closeButton"><img src="http://i1122.photobucket.com/albums/l523/Long_Islander/flyBoxClose.png" width="28" height="28" alt="Close Button" border="0" /></div>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<?php echo "Div ".$i. " Content comes here";?>
</td>
</tr>
</table>
</div>
</div>
<?php }?>

help with php controller function

I'm new to php and I'm trying to understand the basics of how my site is interacting with the database. can someone take a quick look and tell me if they see something wrong with the following code?
Here's the function in the controller
class Spoonful extends C_Controller {
public function index() {
$collectives = $this - > get_mailchimp_collectives();
$this - > data['collectives'] = $collectives;
$this - > load - > view('spoonful');
}
private function get_mailchimp_collectives() {
$constraints['select'] = 'collective.*, member.username, image.path AS avatar';
$constraints['join'] = array(
array('table' = > 'member', 'on' = > 'member.member_id=collective.member_id'), array('table' = > 'collective_tag', 'on' = > 'collective_tag.collective_id=collective.collective_id'), array('table' = > 'tag', 'on' = > 'tag.tag_id=collective_tag.tag_id'), array('table' = > 'image', 'on' = > 'image.image_id=member.avatar_id'));
$constraints['where'] = array('tag.value' = > 'mailchimp');
$constraints['order_by'] = array('collective.added' = > 'DESC');
$constraints['limit'] = array('lower' = > 3);
$collectives = $this - > db - > get('collective', $constraints);
if (!empty($collectives['result_set'])) return $collectives['result_set'];
return NULL;
}
}
and here's the snippet of the view:
<!-- START COLLECTIVES -->
<?php if (!empty($collectives)){?>
<?php foreach ($collectives AS $collective){?>
<tr>
<td bgcolor="#FFFFFF">
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/qc_table_top.gif"); ?>" width="566" height="17"></td>
</tr>
<tr>
<td width="1" bgcolor="#D9D9D9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="1"></td>
<td width="13" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif");?>" width="13" height="1"></td>
<td width="66" valign="top">
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_top.gif"); ?>" width="66" height="5"></td>
</tr>
<tr>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_right.gif"); ?>" width="5" height="45"></td>
<td style="font-size:0;line-height:0;"><img src="<?php echo $collective['avatar']; ?>" width="46" height="45" border="0"></td>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_spike.gif"); ?>" width="15" height="45"></td>
</tr>
<tr>
<td colspan="3" style="font-size;0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_bottom.gif"); ?>" width="66" height="5"></td>
</tr>
</table> </td>
<td width="15" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="15" height="1"></td>
<td width="338" valign="top">
<font style="font-size:15px;line-height:18px;font-weight:bold;" color="#242424" face="Arial, Helvetica, sans-serif"><?php echo $collective['title']; ?></font><br>
<font style="font-size:11px;" color="#A5A5A5" face="Arial, Helvetica, sans-serif">by <a style="text-decoration:none;" href="<?php echo site_url("people/{$collective['username']}"); ?>"><font color="#2294B8"><?php echo $collective['username']; ?></font></a></font> </td>
<td width="30" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="30" height="1"></td>
<td width="81" valign="top">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/answer.gif"); ?>" width="81" height="27" border="0" alt="ANSWER"></td>
</tr>
<tr>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="8"></td>
</tr>
<tr>
<td width="81" align="center" style="text-align:center;"><a style="text-decoration:none;" href="<?php echo site_url("question/{$collective['collective_id']}/{$this->utilities->get_url_title($collective['title'])}");?>"><font style="font-size:11px;" color="#8E8E8E" face="Arial, Helvetica, sans-serif">View Answers</font></a></td>
</tr>
</table> </td>
<td width="21" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif");?>" width="21" height="1"></td>
<td width="1" bgcolor="#D9D9D9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="1"></td>
</tr>
<tr>
<td colspan="9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/qc_table_bottom.gif"); ?>" width="566" height="21"></td>
</tr>
</table> </td>
</tr>
<tr>
<td style="font-size=0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="9"></td>
</tr>
<?php }?>
<?php }?>
but for some reason, i just can't get it to load. if i comment out the lines:
if (!empty($collectives['result_set']))
return $collectives['result_set'];
then the view loads with no data, but when i leave it in, i get a blank page. would love some advice.
thanks so much!
Your two problems that I can see are, first of all the Codeigniter Controller is called CI_Controller not C_Controller (in the version that you're using at least) so:
class Spoonful extends C_Controller {
should be
class Spoonful extends CI_Controller {
Additionally you're not actually passing any data to the view, you do so with the second parameter of the view load function so:
$this - > data['collectives'] = $collectives;
$this - > load - > view('spoonful');
should be
$this - > data['collectives'] = $collectives;
$this - > load - > view('spoonful', $this->data);

Categories