여기 몇 가지 질문이 있으므로 도움을 주시면 대단히 감사하겠습니다. 여기에 3 페이지가 있습니다.mysqli PHP 도움말 선택 문의
//Page 1 - Constants
$dbhost = "database.url.com"; //Just made up
$dbname = "dbname";
$dbuser = "dbuser";
$dbpass = "123456";
//Page 2 - The Function
//This is where i need to write the function select information from the database.
include ("include/page1.php");
$DBH = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
function selectInfo(){
$stmt = $DBH->prepare("SELECT * FROM information LIMIT ?,?");
}
//This function obviously is not complete because I keep recieving different error messages. I guess i cannot figure out how to write a prepared select statement. Need some help here.
//Page 3 - Where the function is called and where the user would be
include ("include/page2.php");
//need to be able to call the function here with variables set.
$start = 0;
$end = 5;
selectInfo();
echo the data that i need in the database.
이것은 아마도 완전히 혼란스러워 보일 것입니다.하지만 여기에서하려고하는 아이디어를 얻을 수 있기를 바랍니다. 가능한 경우 데이터를 가져와
echo $stmt->title;
echo $stmt->id;
과 같이 표시 할 수 있도록 데이터를 가져오고 싶습니다. 아무도 나를 도울 수 있습니까?
덕분에 당신은 당신의 기능을 변경해야합니다
@mcbeav! 3 페이지에서 함수를 호출 할 때 매개 변수를 어떻게 바인딩해야합니까? 2 페이지에서 그렇게해야 하나 3 페이지에 변수를 설정합니까? 변수가 변경됩니다. 예를 들어 페이지 번호 2에 코드의 첫 번째 행을 추가 한 다음 페이지 3의 함수를 호출 할 때 변수를 설정합니다. ex : Page - 3 - $ start = 0; $ end = 5; selectInfo(); – mcbeav