这是我的功能插入。
在findOne之后我应该写什么来更新表。如果字段名称存在,请更新所有其他字段。
function insert_data_score($name, $clickcountscore, $levelofitems, $bonuscounter, $date, $timeofcasinobutton, $timeofcasinovideo){
$repeatChecker = R:: findOne('clicker', 'name = ?', array ($name));
if (isset($repeatChecker))
// ????????
return " User $name exist";
$scoreboard = R::xdispense( 'clicker' );
$scoreboard->name = $name;
$scoreboard->clickcountscore = $clickcountscore;
$scoreboard->levelofitems = $levelofitems;
$scoreboard->bonuscounter = $bonuscounter;
$scoreboard->date = $date;
$scoreboard->timeofcasinobutton = $timeofcasinobutton;
R::store($scoreboard);
return "User: $name, created";
最佳答案
$repeatChecker->clickcountscore = $clickcountscore;
$repeatChecker->levelofitems = $levelofitems;
$repeatChecker->bonuscounter = $bonuscounter;
$repeatChecker->date = $date;
$repeatChecker->timeofcasinobutton = $timeofcasinobutton;
$repeatChecker->timeofcasinovideo = $timeofcasinovideo;
R::store($repeatChecker);
return " User $name Updated";
在“如果”之后添加此代码的所有作品
关于mysql - 如何在redbeanphp中更新表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50944313/