Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Retrive a Student record From mysql
Old 12-20-2005, 04:47 AM Retrive a Student record From mysql
Junior Talker

Posts: 3
Trades: 0
hi all there;
any body can help me with this problem ,
i have atable of students degree (marks) which is thousands of records ;

the structure of the table Students_copy;

CREATE DATABASE hn;
USE hn;

--
-- Table structure for table `hn`.`students_copy`
--

CREATE TABLE `students_copy` ( `examid` text,
`student_name` varchar(255) character set utf8 collate utf8_unicode_ci default NULL,
`kurdish` varchar(10) default NULL,
`arabic` varchar(10) default NULL,
`english` varchar(10) default NULL,
`sociality` varchar(10) default NULL,
`mathmatic` varchar(10) default NULL,
`biology` varchar(10) default NULL,
`chemistry` varchar(10) default NULL,
`physics` varchar(10) default NULL,
`sum` varchar(10) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 4096 kB; InnoDB free: 10240 kB';

--

--
INSERT INTO `students_copy` (`examid`,`student_name`,`kurdish`,`arabic`,`engli sh`,`sociality`,`mathmatic`,`biology`,`chemistry`, `physics`,`sum`) VALUES
('3726','ئارام سعدى على','66','50','50','71','54','56','37','31','415' ),
('3727','ئارام على احمد','65','62','54','67','60','84','64','77','533 '),
('3728','ئارام فتاح قادر','63','58','50','61','31','61','38','54','416 '),
('3729','ئارى صابر عزيز','50','38','29','57','19','29','10','51','283 '),
('3730','ئاسؤ ثوشو كريم','63','54','50','71','50','64','54','56','462 '),
('3731','ئوميد حسن كريم','56','50','27','55','50','54','29','51','372 '),
('3732','ئوميد مجيد عمر','67','66','58','61','73','75','50','56','506' ),
('3733','ئوميد محمد ابراهيم','64','57','51','65','51','62','30','53',' 433'),
('3734','احمد ئادم احمد','56','66','34','60','56','72','59','54','457 '),
('3735','احمدخان عولاخان','61','50','32','71','50','60','50','63',' 437'),
('3736','احمد صابر رسول','63','50','37','56','33','74','52','64','429 ');

.
.
.
etc....

which has thousands of records but i didnt put all of them because this post will be full of names but here is some sample of it .




and i want to make a page to search a student record just when he inputs his examid html form .
and i maked an html form see it which is named search_students.html ;

<html>
<head>
<title>search for a student</title>
</head>
<body>
<h2>Search for a student degree</h2>
<br>
<form action="students_copy.php" method="post">
Please enter the ID of the Student Exam :
<br>
<input examid="examid" type=text>
<br>
<input type=submit value="search">
</form>
</body>
</html>


and i maked a php script to retrive the table which is named
students_copy.php you can see it;

<?php
$db=mysql_connect("myhost_name","myuser_name","my_ pw");
mysql_select_db("hn",$db);
$query="select * from students_copy where examid like '%".$examid."%'";
$result=mysql_query($query);
while ($record=mysql_fetch_assoc($result)){
while (list($fieldname,$fieldvalue)=each($record)){
echo $fieldname.":<b>".$fieldvalue."</b><br>";
}
echo "<BR>";
}
?>


and this script not work and outputed to me ;
Notice: Undefined variable: examid in C:\Program Files\Apache Group\Apache2\htdocs\hemin\students_copy.php on line 4
and
all the databases content with this error


can any one help me to give approprite script to retrive one record that validate with the input examid and out put only the record that inputed in html form to just this student.


thanks for your help.....
hemin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-20-2005, 11:20 AM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
<input examid="examid" type=text>

Should this not read

<input name="examid" type=text>

???
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 12-21-2005, 12:54 AM retrive a student record from mysql
Junior Talker

Posts: 3
Trades: 0
hi;
i tried that and its the same thing......
the problem is still the same undefined variable examid.
hemin is offline
Reply With Quote
View Public Profile
 
Old 12-21-2005, 02:12 AM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Have you tried adding this to your page:

$examid = "$_POST[examid]";

I think it depends on your php settings as to whether a form element is immediately recognised as a variable after submission without calling it with post first.

Dont quote me on that though
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 12-22-2005, 03:06 AM retrive a student record from mysql
Junior Talker

Posts: 3
Trades: 0
hi hiptobesquare ;
thanks to you this udeful info and its now working my code and the problem solved..

thanks to your help
hemin is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Retrive a Student record From mysql
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15592 seconds with 12 queries