在控制器中打印查询对象

时间:2015-12-16 07:32:14

标签: ruby-on-rails ruby

我是Rails的新手,我试图像在PHP中<!DOCTYPE html> <html> <head> </head> <body> <form method='post' action=''> <input type="text" name='Comment'/> <input type="Submit" value="Submit" name="Submit" /> </form> <?php $server="localhost"; $username="root"; $password=""; $database="escalation"; $conn = new mysqli($server, $username, $password, $database); if ($conn->connect_error) { die("connection failed:" . $conn->connect_error); } if(isset($_POST['Submit'])){ $Comment=isset($_POST['Comment']) ?$_POST['Comment']:''; $sql="INSERT INTO css(Dis_Cmt)VALUES('$Comment')"; $res=$conn->query($sql); if($res){ echo "Successful"; echo "<BR>"; echo "<a href='Uploadphp.php'>Back to main page</a>"; } else { echo "ERROR"; } } ?> </body> </html> 一样打印查询对象 我见过rails console选项, print_r在视图中打印 但是没有找到任何选项如何正确获取对象的内容

0 个答案:

没有答案