我在5个小时左右的时间里一直在禁止我在这个问题上的头脑,我确实感到沮丧,需要一些援助。
I m 撰写一本书,将工作从MySQL表格中删除,然后编写各种数据库管理任务。 目前的任务是“建立数据库”。 该书成功地建立了数据库,但当我着手为私人住房开发商制作汇辑时,该书被炸毁。
I believe it is an issue with referencing and dereferencing variables, but I m not quite sure what exactly is happening. I think after this function call, something happens to
$$result{ databaseName }. This is how I get result: $result = $select->fetchrow_hashref()
Here is my function call, and the function implementation:
职能呼吁(第127条):
generateConfig($$result{ databaseName }, $newPassword, "php");
职能执行:
sub generateConfig {
my($inName) = $_[0];
my($inPass) = $_[1];
my($inExt) = $_[2];
my($goodData) = 1;
my($select) = $dbh->prepare("SELECT id FROM $databasesTableName WHERE name = $inName ");
my($path) = $documentRoot.$inName."_config.".$inExt;
$select->execute();
if ($select->rows < 1 ) {
$goodData = 0;
}
while ( $result = $select->fetchrow_hashref() )
{
my($insert) = $dbh->do("INSERT INTO $configTableName(databaseId, username, password, path)".
"VALUES( $$result{ id } , $inName , $inPass , $path )");
}
return 1;
}
错误:
Use of uninitialized value in concatenation (.) or string at ./dbcreator.pl line 142.
Use of uninitialized value in concatenation (.) or string at ./dbcreator.pl line 154.
第142条
$update = $dbh->do("UPDATE ${tablename}
SET ${jobStatus}= ${newStatus}
WHERE id = $$result{ id } ");
Line 154:
print "Successfully created $$result{ databaseName }
";
我认为,问题源于职能呼吁,因为如果我评论职能呼吁,一切都发挥了巨大作用!
If anyone could help me understand what s going on, that would be great.
感谢
p.s. 如果你注意到一个安全问题,即整个密码存放在一个数据库中作为平原文本,那么这个问题将在工作正确之后处理。 = 1P
Dylan