Benim sorunu çözmek olabilir cevapları alamadım, dün bu attılar ama ben nasıl olsa bazı oldukça iyi fikirler var. Bu kod db ilişkili satır alır ve ben bir profil bilgi olarak görüntülemek böylece PHP dizi haline çevirir. İşte benim geçerli kod:
Query:
<?php
require 'includes/constants.php';
class newMysql {
private $conn;
function __construct() {
$conn = mysql_connect(DB_SERVER_USERS, DB_USER_USERS, DB_PASSWORD_USERS, DB_NAME_USERS);
if(!$conn) die('There was a problem connecting to the database.');
}
function get_profile(mysql_escape_string($lname)) {
$query = "SELECT * FROM members WHERE lname = '".$lname."' ";
$registerquery = mysql_query($query);
if($registerquery){
if (gettype($registerquery) == "resource") {
if (mysql_num_rows($result) != 0 ) {
while ($row = mysql_fetch_assoc($registerquery)) {
$profile[] = $row;
}
return $profile;
}
}
if(gettype($registerquery) == "boolean") {
return "No array returned";
}
}
else return "Query not successful".$registerquery;
}
}
Display:
<?php
require 'classes/newMysql.php';
$mysql = new newMysql();
$profile = array();
$profile = $mysql->get_profile("lozano");
echo $profile;
Whatever I do, I get the message: "Query not successful". So the query does not return anything? It doesn't complain about db connection failure either. I tried the query directly from the CLI, it did return the expected row of data.
Herhangi bir yardım pls ...