คือต้องการจะทำให้เลือกได้ว่าจะค้นหาจากอะไรอะค่ะ มี 3 อย่างอะค่ะ แล้วก็ดาต้าเบสที่จะใช้เกี่ยวข้องมี 3 ตารางอะค่ะ เลยเขียนเชื่อมกันด้วย AND แต่ไม่ทราบว่าเขียนถูกหรือเปล่าอ่ะค่ะ
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\AppServ\www\Project\search_by_title.php on line 196
จำนวนที่พบ: รายการ
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\AppServ\www\Project\search_by_title.php on line 198
2.
ลองเอาวงเล็บปีกกาออกดูน่ะ
SELECT * FROM researcher,project,researcher_project WHERE $search_field
LIKE '%$search_term%' AND (r_id=id) AND (project_id=pro_id)
3. เปลี่ยนแนวเขียนใหม่
select *
from researcher_project as rp
right join researcher as r
on r.r_id=rp.id
right join project as p
on p.pro_id=rp.project_id
where $search_field
like '%$search_term%'
order by rp.id
Date :
2009-12-27 02:27:52
By :
xbeginner01
No. 8
Guest
SELECT * FROM researcher_project as rp right join researcher as r on r.r_id=rp.id right join project as p on p.pro_id=rp.project_id WHERE r_name LIKE '%กนกวรรณ%' ;
CREATE TABLE `journal` (
`pro_id` varchar(10) NOT NULL,
`pro_ename` varchar(100) NOT NULL,
`pro_thname` varchar(100) NOT NULL,
`scholarship_id` varchar(10) NOT NULL,
`start_year` year(4) NOT NULL,
`end_year` year(4) NOT NULL,
`complete` datetime NOT NULL,
`abstract` text NOT NULL,
PRIMARY KEY (`pro_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `journal`
--
Table structure for table `member`
--
CREATE TABLE `member` (
`mem_id` int(4) NOT NULL auto_increment,
`user` varchar(8) NOT NULL,
`pass` varchar(25) NOT NULL,
`repass` varchar(25) NOT NULL,
`name` varchar(50) NOT NULL,
`surname` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`department` varchar(50) NOT NULL,
`degree` varchar(8) NOT NULL,
PRIMARY KEY (`mem_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620 AUTO_INCREMENT=47 ;
--
-- Dumping data for table `member`
Table structure for table `other_researcher`
--
CREATE TABLE `other_researcher` (
`o_id` varchar(10) NOT NULL,
`o_name` varchar(100) NOT NULL,
`o_email` varchar(100) NOT NULL,
`o_pic` blob NOT NULL,
`o_company` varchar(100) NOT NULL,
PRIMARY KEY (`o_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `other_researcher`
--
Table structure for table `pcu`
--
CREATE TABLE `pcu` (
`id` varchar(4) NOT NULL,
`nopcu` varchar(20) NOT NULL,
`rela` varchar(100) NOT NULL,
`pro_th` varchar(100) NOT NULL,
`pro_eng` varchar(500) NOT NULL,
`publish` varchar(100) NOT NULL,
`req` varchar(100) NOT NULL,
`send_journal` varchar(50) NOT NULL,
`send_cd` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `pcu`
--
Table structure for table `progess_report`
--
CREATE TABLE `progess_report` (
`pro_id` varchar(10) NOT NULL,
`progress_id` varchar(10) NOT NULL,
`file` varchar(0) NOT NULL,
`sent_date` date NOT NULL,
PRIMARY KEY (`pro_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `progess_report`
--
Table structure for table `researcher`
--
CREATE TABLE `researcher` (
`r_id` varchar(11) NOT NULL,
`r_name` varchar(100) NOT NULL,
`r_status` varchar(10) NOT NULL,
`r_phone` varchar(10) NOT NULL,
`r_email` varchar(100) NOT NULL,
`r_pic` blob NOT NULL,
`r_university` varchar(100) NOT NULL,
`r_faculty` varchar(100) NOT NULL,
`r_department` varchar(100) NOT NULL,
`papercount` varchar(100) NOT NULL,
PRIMARY KEY (`r_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `researcher`
--
Table structure for table `researcher_project`
--
CREATE TABLE `researcher_project` (
`id` varchar(10) NOT NULL,
`project_id` varchar(10) NOT NULL,
`status_id` varchar(10) NOT NULL,
`memo` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `researcher_project`
--
Table structure for table `scholarship`
--
CREATE TABLE `scholarship` (
`sch_id` varchar(10) NOT NULL,
`sch_type` varchar(50) NOT NULL,
`period` varchar(100) NOT NULL,
`source` varchar(100) NOT NULL,
`in_id` varchar(10) NOT NULL,
`out_id` varchar(10) NOT NULL,
PRIMARY KEY (`sch_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `scholarship`
--
Table structure for table `status`
--
CREATE TABLE `status` (
`status_id` varchar(10) NOT NULL,
`status_name` varchar(25) NOT NULL,
PRIMARY KEY (`status_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `status`
--
Table structure for table `student`
--
CREATE TABLE `student` (
`s_id` varchar(10) NOT NULL,
`s_name` varchar(100) NOT NULL,
`s_email` varchar(100) NOT NULL,
`s_pic` blob NOT NULL,
`s_university` varchar(100) NOT NULL,
`s_faculty` varchar(100) NOT NULL,
`s_department` varchar(100) NOT NULL,
`edu_level` varchar(100) NOT NULL,
PRIMARY KEY (`s_id`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
ตอนนี้มันขึ้น error แบบนี้ แบบว่าไรหรอค่ะ
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\AppServ\www\Project\search_by_title.php on line 199
จำนวนที่พบ: รายการ
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\AppServ\www\Project\search_by_title.php on line 201
CREATE TABLE `researcher_project` (
`id` varchar(10) NOT NULL,
`project_id` varchar(10) NOT NULL,
`status_id` varchar(10) NOT NULL,
`memo` text NOT NULL,
) ENGINE=MyISAM DEFAULT CHARSET=tis620;