作者:1098502132_027279 | 来源:互联网 | 2023-09-18 09:16
OkayIaskedaquestionlastweek.Igotafewanswers,severalwhichdidnothelp;however,Idecid
Okay I asked a question last week. I got a few answers, several which did not help; however, I decided to recheck all of my connections. That did resolve some problems after I had to check here to make it function. Next was for some reason I did not check my query to make sure it worked in mysql. I also noticed that my version has a way to output the query into PHP code which I did. Now I am stuck with the error code:
我上周问了一个问题。我得到了几个答案,几个没有帮助;然而,我决定重新检查我所有的连接。这确实解决了一些问题,因为我必须在这里检查以使它具有功能。接下来是出于某种原因,我没有检查我的查询以确保它在mysql中工作。我还注意到,我的版本有一种方法可以将查询输出到PHP代码中。现在我被错误代码卡住了:
Fatal error: Call to undefined method mysqli::SELECT tblConference.colConferenceName, tblSchool.colSchoolName, tblSchool.colClass, tblSurface.colSurfaceName, tblSurface.colSurfaceCompany, tblStadium.colStadiumName, tblStadium.colAddress, tblStadium.colCity, tblStadium.colRegion, tblStadium.colCounty, tblStadium.colCapacity FROM tblStadium, tblConference, tblSurface, tblSchool, tblStadiumSchool WHERE tblConference.colCOnferenceID= tblSchool.colConferenceID AND tblSurface.colSurfaceID = tblStadium.colSurfaceID AND tblStadium.colStadiumID = tblStadiumSchool.colStadiumID AND tblSchool.colSchoolID = tblStadiumSchool.colSchoolID AND tblSchool.colSchoolName LIKE \'A%\' ORDER BY tblSchool.colSchoolName() in C:\xampp\htdocs\stadium\alpha\a.php on line 24
致命错误:调用未定义的方法mysqli::选择tblConference。colConferenceName tblSchool。colSchoolName tblSchool。colClass tblSurface。colSurfaceName tblSurface。colSurfaceCompany tblStadium。colStadiumName tblStadium。colAddress tblStadium。colCity tblStadium。colRegion tblStadium。colCounty tblStadium。来自tblStadium, tblConference, tblSurface, tblSchool, tblStadiumSchool, tblConference的colCapacity。colCOnferenceID= tblSchool。colConferenceID tblSurface。colSurfaceID = tblStadium。colSurfaceID tblStadium。colStadiumID = tblStadiumSchool。colStadiumID tblSchool。colSchoolID = tblStadiumSchool。colSchoolID tblSchool。colSchoolName(类似于tblSchool.colSchoolName())在C:\xampp\htdocs\体育场\alpha\ A。php在24行
Now here is my new code, I will try to make it look halfway decently,
这是我的新代码,我会尽量让它看起来很漂亮,
$mysqli = new mysqli("localhost", "root", "", "dbstadium");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error);
exit();
}
/* your sql query */
$sql = "SELECT tblConference.colConferenceName, tblSchool.colSchoolName, tblSchool.colClass, tblSurface.colSurfaceName, tblSurface.colSurfaceCompany, tblStadium.colStadiumName, tblStadium.colAddress, tblStadium.colCity, tblStadium.colRegion, tblStadium.colCounty, tblStadium.colCapacity FROM tblStadium, tblConference, tblSurface, tblSchool, tblStadiumSchool WHERE tblConference.colCOnferenceID= tblSchool.colConferenceID AND tblSurface.colSurfaceID = tblStadium.colSurfaceID AND tblStadium.colStadiumID = tblStadiumSchool.colStadiumID AND tblSchool.colSchoolID = tblStadiumSchool.colSchoolID AND tblSchool.colSchoolName LIKE \'A%\' ORDER BY tblSchool.colSchoolName";
sql = "选择tblConference美元。colConferenceName tblSchool。colSchoolName tblSchool。colClass tblSurface。colSurfaceName tblSurface。colSurfaceCompany tblStadium。colStadiumName tblStadium。colAddress tblStadium。colCity tblStadium。colRegion tblStadium。colCounty tblStadium。来自tblStadium, tblConference, tblSurface, tblSchool, tblStadiumSchool, tblConference的colCapacity。colCOnferenceID= tblSchool。colConferenceID tblSurface。colSurfaceID = tblStadium。colSurfaceID tblStadium。colStadiumID = tblStadiumSchool。colStadiumID tblSchool。colSchoolID = tblStadiumSchool。colSchoolID tblSchool。colSchoolName LIKE \'A%\' ORDER BY tblSchool.colSchoolName";
/* query your db */
if ($result = $mysqli->$sql($sql)) {
/* fetch associative array */
while ($row = $sql->fetch_assoc())
{ /* display row */
echo 'School Name: ' . $row['colSchoolName'] . 'Conference: ' . $row['colConferenceName'] . 'Class: ' . $row['colClass'] . 'Stadium Name: ' . $row['colStadiumName'] . 'Address: ' . $row['colAddress'] . 'City: ' . $row['colCity'] . 'County: ' . $row['colCounty'] . 'Region: ' . $row['colRegion'] . 'Capacity: ' . $row['colCapacity'] . 'Surface Type: ' . $row['colSurfaceName'] . 'Surface Company: ' . $row['colSurfaceCompany'] . 'Year Installed: ' . $row['colSurfaceYear'] . '
';
}
/* free result set */
$result->free();
}
/* close connection */
$mysqli->close();
Now I am not sure what the issue is. I been trying to get this to work. BTW just so you know the query and connection should not be an issue. If their is something I am missing just let me know.
现在我不知道这个问题是什么。我一直试着让它发挥作用。顺便说一下,您知道查询和连接不应该是一个问题。如果他们是我错过的东西,请告诉我。
2 个解决方案