我有这样的代码,我不知道我的代码有什么问题
$peringkat=0;
//pencarian ranking terbesar ke terkecil berdasarkan value
$ranking = array("$ATTT[0]" => "$HA[0]", "$ATTT[1]" => "$HA[1]");
arsort($ranking);
foreach ($ranking as $alternatif => $nilaialternatif) {
$peringkat++;
echo "
<th class='akhir'><input class='rankingakhir' type='text' name='alternatif'
value='$alternatif' size='12' readonly></th>
<td class='akhir'><input class='nilaiakhir' type='text'
name='nilaialternatif' value=".number_format($nilaialternatif, 3, '.', ',')." size='12' readonly></td>
<td class='akhir'><input class='rankakhir' type='text'
name='rankingalternatif' value='$peringkat' size='12' readonly></td></tr>";
}
echo '</table><div class="akhir"><input class="akhir" type="submit"
value="Simpan Ranking ke Database"></div></div></div>
我运行var dump但只记录来自alternatif 2的数据
array(3) { ["alternatif"]=> string(12) "Alternatif 2" ["nilaialternatif"]=> string(5) "0.223" ["rankingalternatif"]=> string(1) "2" }
实时设计中的表格
我的数据库代码
$Host = "localhost"; //Memilih host, Localhost berarti komputer itu sendiri
$User = "root"; //Memilih user/pengguna
$Password = ""; //Password, Biasanya Kosong
$db = "spkjazuly"; //Memilih Database
$konek=mysql_connect($Host,$User,$Password)or die (mysql_error());
mysql_select_db ($db,$konek) or die (mysql_error("TIdak Terhubung Ke Server
Mysql")); //Menghubungkan ke Mysql dan memilih Database
mysql_query("replace INTO ranking VALUE(DEFAULT,'$_GET[B11]','$_GET[alternatif]','$_GET[nilaialternatif]','$_GET[rankingalternatif]')") //Perintah Mysql untuk mengisi tabel Tamu
or die(mysql_error("Tidak Berhasil Menyimpan !")); //Or Die (mysql_error()) Pesan Error
echo "<h1>Berhasil Menyimpan Data</h1>";
对于我的英语,我尽我所能。
答案 0 :(得分:-1)
连接到您的数据库尝试这个并且不要大写变量
namespace TelegramBotConsole
{
class Program
{
// Keyboards
public static ReplyKeyboardMarkup MainMenu;
// Telegram Bot Token.
private static string BotToken="Bot_Api";
static void Main(string[] args)
{
// Add The Keuboards
MainMenu = new ReplyKeyboardMarkup
{
Keyboard = new[] { new[] { "Amuzeshha" }, new[] { "Rahnama", "About" } }
};
// Running The Bot.
Task.Run(() => RunBot());
// Read The Log of Bot.
Console.ReadLine();
}
// Create Bot.
public static async Task RunBot()
{
var Bot = new TelegramBot(BotToken);
var Me = await Bot.MakeRequestAsync(new GetMe());
// Geting The Infromation of Bot.
Console.WriteLine("Username Is : {0}", Me.Username);
Console.WriteLine("My ID Is : {0}", Me.Id);
Console.WriteLine("My Name Is : {0}", Me.FirstName);
long offset = 0;
while (true)
{
var updates = await Bot.MakeRequestAsync(new GetUpdates() { Offset = offset });
foreach (var update in updates)
{
offset = update.UpdateId + 1;
var text = update.Message.Text;
if (text == "/start")
{
var Req = new SendMessage(update.Message.Chat.Id, "You Should Send Picture") { ReplyMarkup = MainMenu };
await Bot.MakeRequestAsync(Req);
continue;
}
if(update.Message.Photo == null)
{
var Req = new SendMessage(update.Message.Chat.Id, "Please Send A Picture") { ReplyMarkup = MainMenu };
await Bot.MakeRequestAsync(Req);
continue;
}
else
{
var Req = new SendMessage(update.Message.Chat.Id, "Thanks") { ReplyMarkup = MainMenu};
await Bot.MakeRequestAsync(Req);
continue;
}
}
}
}
}