I am trying to select a row form StudyCenter Table form the data selected in project table. I get the Error on this code. This is my code
<html>
<head>
<title>table</title>
</head>
<body>
<?php
$v_name = JRequest::getString('v_name', '', 'get');
if ( $v_name )
{
$result = mysql_query( "SELECT Project_Name,fabrik_internal_id,Activity_Name,Description FROM Project where fabrik_internal_id = $db->quote($v_name) ")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
//print "There are $num_rows records.<P>";
print "<table width=400 border=0>\n";
print "<th> Project Name </th>";
print "<th> Project Number </th>";
print "<th> Activity Name </th>";
print "<th> Description </th>";
while ($get_info = mysql_fetch_row($result))
{
print "<tr>\n";
print "<td>".$get_info[0]."</td>";
print "<td>".$get_info[1]."</td>";
print "<td>".$get_info[2]."</td>";
print "<td>".$get_info[3]."</td>";
$pname = $get_info[0];
print "</tr>\n";
}
print "</table>\n";
}
$v_name = JRequest::getString('v_name', '', 'get');
if ( $v_name )
{
$result = mysql_query( "SELECT Project.School_Name_Code,Project.Village, Project.Project_Academic_Year, Study_Center.Head_Masters_Name, Study_Center.Instructor_Name, Study_Center.Supervisor_Name, Study_Center.No_Male_Students+Study_Center.No_Female_Students, Project.Expected_Start_Date, Project.Expected_Complete_Date FROM Project,Study_Center WHERE Project.fabrik_internal_id = $db->quote($v_name) AND
Study_Center.project_id = '$pname' ")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
//print "There are $num_rows records.<P>";
print "<table width=400 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
echo "<tr> <td>School Name:</td>". "<td> $get_info[0]</td>". "</tr><br/>";
echo "<tr> <td>Village:</td>". "<td> $get_info[1]</td>". "</tr><br/>";
echo "<tr> <td>Academic year:</td>". "<td>$get_info[2]</td>"."</td></tr><br/>";
echo "<tr> <td>Headmaster:</td>". "<td> $get_info[3]</td>"."</td></tr><br/>";
echo "<tr> <td>Studycenter Instructor:</td>". "<td> $get_info[4]</td>"."</td></tr><br/>";
echo "<tr> <td>Study Center Supervisor</td>". "<td> $get_info[5]</td>"."</td></tr><br/>";
echo "<tr> <td>Number of Students Enrolled</td>". "<td> $get_info[6]</td>"."</td></tr><br/>";
echo "<tr> <td>Started On</td>". "<td> $get_info[7]</td>"."</td></tr><br/>";
echo "<tr> <td>Estimated Completion</td>". "<td> $get_info[8]</td>"."</td></tr><br/>";
print "</tr>\n";
}
print "</table>\n";
}
?>
</body>
</html>
And I get the Error Like this.
Notice: Undefined variable: db in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/chronocontact.html.php(180) : eval()'d code on line 10
Notice: Trying to get property of non-object in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/chronocontact.html.php(180) : eval()'d code on line 10
Project Name Project Number Activity Name Description
This Is the Sample project 2 18 Study Centres Testing the componenets
Notice: Undefined variable: db in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/chronocontact.html.php(180) : eval()'d code on line 42
Notice: Trying to get property of non-object in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/chronocontact.html.php(180) : eval()'d code on line 42
Can You Pl Help me on this
Regards,
Shoaib.
😀
I'm not clear where you are using this. The code doesn't look correct for any of the ChronoConnectivity boxes.
That said, the problem is $db->quote($v_name). You need to define $db before using this.
$db =& JFactory:;getDBO();
Bob
Sorry I should have send u The Screenshots. I have attached the Screenshots with this thread.
Hope U will have clear view now about the coding.
As U can see the Screenshot StudyCenter.jpg On clicking the link in Column Studycenter the page navigates to the Linkpage.jpg
Regards,
Shoaib.
I checked it but there didn't seem to be a question.
The Errors are the same as the previous ones about $db.
What else isn't working?
Bob
I Turned off the SEF. Now it is not working. The error page which I have attached in previous thread I see Blank Page now. Both the Select Query is not working.
Regards,
Shoaib.
😀
Friendly Bump
I Turned off the SEF. Now it is not working. The error page which I have attached in previous thread I see Blank Page now. Both the Select Query is not working.
here is my coding of the linkpage
<html>
<head>
<title>table</title>
</head>
<body>
<?php
$v_name = JRequest::getString('v_name', '', 'get');
if ( $v_name )
{
$result = mysql_query( "SELECT Project_Name,fabrik_internal_id,Activity_Name,Description FROM Project where fabrik_internal_id = $db->quote($v_name) ")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
//print "There are $num_rows records.<P>";
print "<table width=400 border=0>\n";
print "<th> Project Name </th>";
print "<th> Project Number </th>";
print "<th> Activity Name </th>";
print "<th> Description </th>";
while ($get_info = mysql_fetch_row($result))
{
print "<tr>\n";
print "<td>".$get_info[0]."</td>";
print "<td>".$get_info[1]."</td>";
print "<td>".$get_info[2]."</td>";
print "<td>".$get_info[3]."</td>";
$pname = $get_info[0];
print "</tr>\n";
}
print "</table>\n";
}
/*
$v_name = JRequest::getString('v_name', '', 'get');
if ( $v_name )
{
$result = mysql_query( "SELECT Project.School_Name_Code,Project.Village,Project.Project_Academic_Year, Study_Center.Head_Masters_Name,Study_Center.Instructor_Name, Study_Center.Supervisor_Name,Study_Center.No_Male_Students+Study_Center.No_Female_Students, Project.Expected_Start_Date, Project.Expected_Complete_Date FROM Project,Study_Center WHERE Project.fabrik_internal_id = $db->quote($v_name) AND
Study_Center.project_id = '$pname' ")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
//print "There are $num_rows records.<P>";
print "<table width=400 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
echo "<tr> <td>School Name:</td>". "<td> $get_info[0]</td>". "</tr><br/>";
echo "<tr> <td>Village:</td>". "<td> $get_info[1]</td>". "</tr><br/>";
echo "<tr> <td>Academic year:</td>". "<td>$get_info[2]</td>"."</td></tr><br/>";
echo "<tr> <td>Headmaster:</td>". "<td> $get_info[3]</td>"."</td></tr><br/>";
echo "<tr> <td>Studycenter Instructor:</td>". "<td> $get_info[4]</td>"."</td></tr><br/>";
echo "<tr> <td>Study Center Supervisor</td>". "<td> $get_info[5]</td>"."</td></tr><br/>";
echo "<tr> <td>Number of Students Enrolled</td>". "<td> $get_info[6]</td>"."</td></tr><br/>";
echo "<tr> <td>Started On</td>". "<td> $get_info[7]</td>"."</td></tr><br/>";
echo "<tr> <td>Estimated Completion</td>". "<td> $get_info[8]</td>"."</td></tr><br/>";
print "</tr>\n";
}
print "</table>\n";
}
*/
?>
</body>
</html>
Regards,
Shoaib.
The answer is still the same, you need to define $db with the code I posted earlier. No point in bumping until you've tried the previous suggestions.
Bob
I am sorry. I have added "$db =& JFactory:;getDBO();" in my code now I get no error. But now I am getting only black page.
I think there is problem in retriving the URL variable v_name.
I have attached the codings.
<html>
<head>
<title>table</title>
</head>
<body>
<?php
$db =& JFactory::getDBO();
$v_name = JRequest::getString('v_name', '', 'get');
if ( $v_name )
{
$result = mysql_query( "SELECT Project_Name,fabrik_internal_id,Activity_Name,Description
FROM Project where fabrik_internal_id = $db->quote($v_name) ")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
//print "There are $num_rows records.<P>";
print "<table width=400 border=0>\n";
print "<th> Project Name </th>";
print "<th> Project Number </th>";
print "<th> Activity Name </th>";
print "<th> Description </th>";
while ($get_info = mysql_fetch_row($result))
{
print "<tr>\n";
print "<td>".$get_info[0]."</td>";
print "<td>".$get_info[1]."</td>";
print "<td>".$get_info[2]."</td>";
print "<td>".$get_info[3]."</td>";
$pname = $get_info[0];
print "</tr>\n";
}
print "</table>\n";
}
$v_name = JRequest::getString('v_name', '', 'get');
if ( $v_name )
{
$result = mysql_query( "SELECT Project.School_Name_Code,Project.Village,Project.Project_Academic_Year,
Study_Center.Head_Masters_Name,Study_Center.Instructor_Name,Study_Center.Supervisor_Name,
Study_Center.No_Male_Students+Study_Center.No_Female_Students,Project.Expected_Start_Date,
Project.Expected_Complete_Date FROM Project,Study_Center WHERE Project.fabrik_internal_id = $db->quote($v_name) AND
Study_Center.project_id = '$pname' ")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
//print "There are $num_rows records.<P>";
print "<table width=400 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
echo "<tr> <td>School Name:</td>". "<td> $get_info[0]</td>". "</tr><br/>";
echo "<tr> <td>Village:</td>". "<td> $get_info[1]</td>". "</tr><br/>";
echo "<tr> <td>Academic year:</td>". "<td>$get_info[2]</td>"."</td></tr><br/>";
echo "<tr> <td>Headmaster:</td>". "<td> $get_info[3]</td>"."</td></tr><br/>";
echo "<tr> <td>Studycenter Instructor:</td>". "<td> $get_info[4]</td>"."</td></tr><br/>";
echo "<tr> <td>Study Center Supervisor</td>". "<td> $get_info[5]</td>"."</td></tr><br/>";
echo "<tr> <td>Number of Students Enrolled</td>". "<td> $get_info[6]</td>"."</td></tr><br/>";
echo "<tr> <td>Started On</td>". "<td> $get_info[7]</td>"."</td></tr><br/>";
echo "<tr> <td>Estimated Completion</td>". "<td> $get_info[8]</td>"."</td></tr><br/>";
print "</tr>\n";
}
print "</table>\n";
}
?>
</body>
</html>
I am new to php and chronoform pl check the above codings and give me right solution. This problem occurs right form when I
Turned off the SEF.
Regards,
Shoaib.