weißt du, was
bewirkt?
PHP-Code:
$data = array();
$data[] = ...
require("_config.php");
function read($sql_ausgabe, $sql_table, $sql_where){
$resultarray = array();
$sql = "SELECT ".$sql_ausgabe." FROM ".$sql_table." WHERE ".$sql_where.";";
echo "SQL: " .$sql;
echo '<br />';
$result = mysql_query($sql) or die(mysql_error());
//$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
$resultarray[] = $row;
}
return $resultarray;
}
$data = array();
$data[] = read("name","user","id='1'");
echo '<br><br><pre>';
print_r($data);
echo '</pre>';
echo "user: " . $data["name"];
SQL: SELECT name FROM user WHERE id='1';
Array
(
[0] => Array
(
[0] => Array
(
[sprache] => testname
)
)
)
sprache:
require("_config.php");
function read($sql_ausgabe, $sql_table, $sql_where){
$sql = "SELECT ".$sql_ausgabe." FROM ".$sql_table." WHERE ".$sql_where.";";
echo "SQL: " .$sql;
echo '<br />';
$result = mysql_query($sql) or die(mysql_error());
//$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
$resultarray = $row;
}
return $resultarray;
}
$data = read("name","user","id='1'");
echo "user: " . $data["name"];
Kommentar