Please Help! Problem in searching
Moderator: General Moderators
Please Help! Problem in searching
I have 4 fields in my database, these are stud_no, stud_name, stud_pass, subject_code. During searching data the the content of stud_no will displayed but the rest will not searched. This is my SQL command during my searching
$grado= $_POST['grado'];
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_no = '$grado'"; (This work)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_pass = '$grado'"; (This will not work)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_name = '$grado'"; (This will not work)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE subject_code = '$grado'"; (This will not work)
in other words only stud_no field who function in searching data.
Please help....
Thank s a lot
$grado= $_POST['grado'];
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_no = '$grado'"; (This work)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_pass = '$grado'"; (This will not work)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_name = '$grado'"; (This will not work)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE subject_code = '$grado'"; (This will not work)
in other words only stud_no field who function in searching data.
Please help....
Thank s a lot
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
No error sir, but the problem if I type in search bar using the $stud_pass no data will displayed. The content of stud_pass row which are the students password will not displayed. As I see the data, only data in stud_no will displayed.
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_no = '$grado'"; (stud_no Data displayed)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_pass = '$grado'"; (stud_pass data does NOT display)
Whats the problem sir.. No error occur but data inside does not search...
thanks a lot
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_no = '$grado'"; (stud_no Data displayed)
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_pass = '$grado'"; (stud_pass data does NOT display)
Whats the problem sir.. No error occur but data inside does not search...
thanks a lot
feyd | Please use
*****************************
*grades.php
****************************
************************
thank you so much
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
****************
*grades1.php
*************Code: Select all
<?php
echo "<form action = grades.php method = post>"
?>
<br />
<br />
<br />
<br />
<div align = center><img src=grades.gif></div>
<table width = "30%" border="1" style="border:thin" bgcolor = "#CFFFFF" align = "center">
<td>
<br />
<font face = arial size = 2>Student #: <input type = "text" name = "grado" size = "20"></font>
<br />
<br />
<div align="center"><input type = "submit" value= "View Grades"></div>
<?php echo "</form>"; ?>*****************************
*grades.php
****************************
Code: Select all
<?php
$stud_pass = $_POST['stud_pass'];
$grado= $_POST['grado'];
if ($grado) {
$metyconnect = mysql_connect("localhost","metysoriano","mety1124") or die ("No database Found");
mysql_select_db(grades2_06_07,$metyconnect);
$metyquery = "SELECT * FROM grades2_06_07_table WHERE stud_pass = '$grado'";
$metyresult = mysql_db_query("grades2_06_07",$metyquery);
$metyquery1 = "SELECT * from grades2_06_07_table";
}
/*
else {
echo "No Record Found";
}
*/
if ($metyresult) {
echo "<div align = center><img src =grades.gif></div><br></br>";
echo "<table width = 90% border = 1 style=border:inset align =center>
<td>
<div align = center><font face = arial size = 3><strong>YOUR GRADES IN SECOND SEMESTER <br> SCHOOL YEAR 2006-2007
<br>
</br>";
echo "<table width=90% border =1 style=border:thin align = center bordercolor = red cellpadding = 0 cellspacing = 0 bgcolor = f2f2f2>
<div align = center>
<font face = verdana size = 3 color = #336666 align = center>
<td align = center width = 25%><font face = arial size = 3><strong>SUBJECT CODE
<td align = center width = 25%><font face = arial size = 3><strong>PRELIM GRADE
<td align = center width = 25%><font face = arial size = 3><strong>MIDTERM GRADE
<td align = center width = 25%><font face = arial size = 3><strong>FINAL GRADE
</td>";
while ($m=mysql_fetch_array($metyresult)) {
$stud_pass = $m['stud_pass'];
$stud_name = $m['stud_name'];
$subject_code = $m['subject_code'];
$prelim_grade = $m['prelim_grade'];
$midterm_grade = $m['midterm_grade'];
$final_grade = $m['final_grade'];
echo "<table width=90% border = 4 style=border:inherit bordercolor = #6fffff align = center cellpadding = 0 cellspacing = 0>";
echo "<tr>
<td align = center width = 25% bgcolor = #cfffff><font face = arial size = 3>$subject_code
<td align = center width = 25% bgcolor=#cfffff><font face = arial size = 3> $prelim_grade
<td align = center width = 25% bgcolor =#cfffff><font face = arial size = 3>$midterm_grade
<td align = center width = 25% bgcolor = #cfffff><font face = arial size = 3>$final_grade
</tr>
</td>
</table>";
}
mysql_close($metyconnect);
echo "<table width = 80% border = 1 align =center style=border:thin>
<td>
<div align = center><font face = verdana size = 2>YOUR ENCRYPTED STUDENT #==>";
echo md5($stud_no);
?>
<br />
<?php
echo md5($stud_pass);
echo "</td>";
echo "<table width = 70% border = 1 align =center style=border:dotted bordercolor=red>
<td>
<div align = center><font face = arial size = 4><strong><u>$stud_name</u></strong>
</table>
</table>
</div>";
}
?>
<div align = center><a href = "http://www.shc.edu.ph">Back to HOME
<div align = center><a href = "#" onclick="window.close()">Closed Grading Online Inquirythank you so much
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]You really need to start with something much simpler so you can learn the fundamentals of using PHP and MySQL. There are so many errors and inconsistencies in the code that you posted that I really don't know where to start.
I really don't think you can salvage this script. Start with something very simple until you learn enough to attempt a more complicated one.
I really don't think you can salvage this script. Start with something very simple until you learn enough to attempt a more complicated one.