TAILIEUCHUNG - Beginning PHP6, Apache, MySQL Web Development- P12
Beginning PHP6, Apache, MySQL Web Development- P12:Welcome to Beginning PHP6, Apache, MySQL Web Development , your new trusty resource for assistance in creating your own dynamic web sites. There are a lot of technologies available that can be used to deliver great web sites, and we ’ re glad you chose the Apache/MySQL/PHP (sometimes referred to simply as AMP) approach. You may or may not have had a taste of these three components in the past, but either way we ’ re confident that you will be impressed with the power that lies within them | Chapter 10 Building Databases input type radio name alignment value evil php echo character alignment evil checked checked Evil td tr tr tr tr td Rivalries br small em CTRL-click to select multiple enemies em small td td php retrieve and present the list of existing characters excluding the character being edited query SELECT character_id alias FROM comic_character WHERE character_id . character_id . ORDER BY alias ASC result mysql_query query db or die mysql_error db if mysql_num_rows result 0 echo select multiple name rivalries while row mysql_fetch_array result if isset rivalries row character_id echo option value . row character_id . selected selected else echo option value . row character_id . echo row alias . option echo select else echo p strong No Characters entered. strong p mysql_free_result result td tr tr td colspan 2 input type submit name action value php echo action Character input type reset value Reset php 301 Part II Comic Book Fan Site if action Edit echo input type submit name action value Delete Character echo input type hidden name character_id value . character_id . td tr table form p a href Return to Home Page a p body html 3. Open your browser and point it to the location of . This is your Character Database home page. It should look something like Figure 10-3. But because you don t currently have any characters to look at let s move on. Figure 10-3 302 Chapter 10 Building Databases 4. Click the Add New Character link. A new page appears ready for your data input which should look like that in Figure 10-4. You will notice that the powers you entered are choices in the Powers field. Figure 10-4 5. Enter the appropriate data for your character and click Add Character. You should be taken back to the Character Database page where you ll see the new character listed as shown in Figure 10-5. .
đang nạp các trang xem trước