|
发表于 2024-4-2 19:12
来自手机
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下https://e.anyoupin.cn/EData/tree/t/php/menus/menu.php
//select * from menuSetup;
cli_add_php~~
echo '<a href="/EData/tree/t/php/menus/menu.php">手机菜单</a><hr>';
$sql="drop TABLE if exists menu;";
$r=$db->query($sql);
$t="create table menu (tableNo,food,food2,food3,food4,totalAmt,checked);";
$t0="create table menu (tableNo,";
for($i=0;$i<26;$i++){
$t0.='food'.$i.",";
}
$t0.="totalAmt,checked);";
$sql=$t0;
$r=$db->query($sql);
$sql="drop TABLE if exists menuSetup;";
$r=$db->query($sql);
$sql="create table menuSetup(required,placeholder,Label,Input,Field,A,B,C,D,E,F,G,H,I,J,K);";
$r=$db->query($sql);
$sql=<<<eof
insert into menuSetup (required,placeholder,Label,Input,Field,A,B,C,D,E,F,G,H,I,J,K) values(1,"桌号","桌号","select","tableName","1号桌","2号桌","3号桌","4号桌","5号桌","6号桌","7号桌","8号桌","9号桌","10号桌","11号桌");
eof;
$r=$db->query($sql);
$dish=<<<eof
宫保鸡丁 46.00
麻辣火锅 78.00
回锅肉 48.00
酸菜鱼 38.00
水煮肉片 58.00
糖醋里脊 56.00
酸辣汤 28.00
拔丝山药 32.00
清蒸鲈鱼 68.00
干煸豆角 32.00
地三鲜 32.00
尖椒干豆腐 28.00
梅菜扣肉 38.00
香辣虾 58.00
红烧肉 58.00
干锅菜花 30.00
蚂蚁上树 42.00
家常豆腐 32.00
葱爆羊肉 46.00
肉末茄子 32.00
东坡肉 48.00
麻辣鳕鱼 38.00
清蒸桂鱼 58.00
苹果醋 1.00
青岛纯生 2.00
白酒 3.00
eof;
$arr_dish=explode("\n",$dish);
foreach ($arr_dish as $k=>$vals){
$v=explode("\t",$vals)[0];
$p=explode("\t",$vals)[1];
$sql=<<<eof
insert into menuSetup (required,placeholder,Label,Input,Field) values(0,"订购数量","<div>$v <i class=""price food$k"" data-rowid=""food$k"">$p</i>元/份</div>","number2","food$k");
eof;
$r=$db->query($sql);
echo "$sql\n";
}
$sql=<<<eof
insert into menuSetup (required,placeholder,Label,Input,Field) values(1,"合计","金额合计","totalAmt","totalAmt");
eof;
$r=$db->query($sql);
echo '<a href="/EData/tree/t/php/menus/menu.php">手机菜单</a>';
$sql="select * from menuSetup";
$r=$db->query($sql);
$result=$r->fetchAll(PDO::FETCH_ASSOC);
dispTable($result);
die;
function dispTable($result){
$headers=array_keys($result[0]);
echo implode('|',$headers);
echo "\n";
foreach($result as $v){
echo implode('|',$v);
echo "\n";
}
echo "\n";
}
~; |
-
|