新手,老师要求做一个简单的早餐订购系统。用mysql存放信息,HTML做出用户登录和订购界面,并且用php将两者连接起来。请问如何链接?万分感谢

我把大概步骤告诉你,很多东西都需要你自己去百度自学,不过相关教程很多的用点心就能学会
1.搭建php环境Apache+PHP+mysql黄金三角
2.建议前后端都使用框架,前端可以是Bootstrap,ace + AngularJS
2.后端php框架建议使用Laravel
看你的样子,这是比新手还新啊。在html界面中可以直接嵌入php代码输出数据,用php提供的mysql系列函数对数据库进行操作。不过还是建议你先几小时的时间,找本书或者视频看一下,你的这些问题都是很基础的,很容易理解,到时候遇到问题再求助一下。
给你看个例子
<!doctype html>
首页
<br> table{<br> width: 980px;<br> }</p> <pre><code></style> </code></pre> <p></head><br> <body><br> <a href="login.php">登录,进入管理员页面</a><br> <?php<br> /**<br> * Created by PhpStorm.<br> * User: yanqiang<br> * Date: 2016/4/17<br> * Time: 4:39<br> <em>/<br> // 1、连接数据库<br> $link=@mysql_connect('localhost','root','miffy1314') or die('连接失败');<br> /</em> if($link){<br> echo'连接成功';</p> <pre><code> } else{ echo'连接失败'; die(); echo'aa'; }*/ // /2、选择数据库 // mysql_query('use data') or die('选择数据库失败'); mysql_select_db('data') or die('数据库选择失败'); //3、获取products表的数据 $result=mysql_query('select * from products'); ?> <table> <tr> <th>编号</th> <th>商品名称</th> <th>规格</th> <th>价格</th> <th>库存量</th> <th>图片</th> <th>网址</th> </tr> <?php while( $rows=mysql_fetch_row($result)){ echo '<tr>'; echo'<td>'.$rows[0].'</td>'; echo'<td>'.$rows[1].'</td>'; echo'<td>'.$rows[2].'</td>'; echo'<td>'.$rows[3].'</td>'; echo'<td>'.$rows[4].'</td>'; echo'<td> <img src="'.$rows[5].'"></td>'; echo'<td>'.$rows[6].'</td>'; echo '</tr>'; } mysql_free_result($result); mysql_close($link); ?> <img src=""> </table> </code></pre> <p></body><br> </html></p> <pre><code> </code></pre>
<!doctype html>
首页
<br> table{<br> width: 980px;<br> }</p> <pre><code></style> </code></pre> <p></head><br> <body><br> <a href="login.php">登录,进入管理员页面</a><br> <?php<br> /**<br> * Created by PhpStorm.<br> * User: yanqiang<br> * Date: 2016/4/17<br> * Time: 4:39<br> <em>/<br> // 1、连接数据库<br> $link=@mysql_connect('localhost','root','miffy1314') or die('连接失败');<br> /</em> if($link){<br> echo'连接成功';</p> <pre><code> } else{ echo'连接失败'; die(); echo'aa'; }*/ // /2、选择数据库 // mysql_query('use data') or die('选择数据库失败'); mysql_select_db('data') or die('数据库选择失败'); //3、获取products表的数据 $result=mysql_query('select * from products'); ?> <table> <tr> <th>编号</th> <th>商品名称</th> <th>规格</th> <th>价格</th> <th>库存量</th> <th>图片</th> <th>网址</th> </tr> <?php while( $rows=mysql_fetch_row($result)){ echo '<tr>'; echo'<td>'.$rows[0].'</td>'; echo'<td>'.$rows[1].'</td>'; echo'<td>'.$rows[2].'</td>'; echo'<td>'.$rows[3].'</td>'; echo'<td>'.$rows[4].'</td>'; echo'<td> <img src="'.$rows[5].'"></td>'; echo'<td>'.$rows[6].'</td>'; echo '</tr>'; } mysql_free_result($result); mysql_close($link); ?> <img src=""> </table> </code></pre> <p></body><br> </html></p>
