I am trying to display all the records from a database in phpMyAdmin. This database is located on my computer which is currently installed on the Uniform Server software server. I am new to php and html code generation I used the last competition documenet code from this link and this is the output on my web page.
& lt; HTML & gt; & Lt; HEAD & gt; & Lt; Title & gt; Log information for all customers & lt; / TITLE & gt; & Lt; / HEAD> & Lt; Body & gt; & Lt; H1 & gt; Log information for the entire database & lt; / H1> & Lt ;? Php $ database = "mobile_app_tracking_log"; Mysql_connect (local host); @ Mysql_select_db ($ database) or die ("Unable to select database"); $ Query = "SELECT * FROM tablename"; $ Result = mysql_query ($ query); Mysql_close (); ? & Gt; & Lt; Table range = "2" cells = "7" cellpadding = "7" & gt; & Lt; TR & gt; & Lt; Th & gt; & Lt; Font face = "aerial, helvetica, non-serif" & gt; Index & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "ariel, helvetica, sans-serif" & gt; Identification number & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "aerial, helvetica, non-serif" & gt; Date & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "ariel, helvetica, sans-serif" & gt; Time & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "aerial, helvetica, non-serif" & gt; Application & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "aerial, helvetica, non-serif" & gt; Use & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "aerial, helvetica, non-serif" & gt; Latitude & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "aerial, helvetica, non-serif" & gt; Longitude & lt; / Font & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Font face = "ariel, helvetica, sans-serif" & gt; Address & lt; / Font & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt ;? Php $ i = 0; Whereas ($ i & lt; $ num) {$ f1 = mysql_result ($ result, $ i, "index"); $ F2-name = mysql_result ($ result, $ i, "identity number"); $ F3-name = mysql_result ($ result, $ i, "date"); $ F4-name = mysql_result ($ result, $ i, "time"); $ F5 name = mysql_result ($ result, $ i, "application"); $ F6-name = mysql_result ($ result, $ i, "use"); $ F7 name = mysql_result ($ result, $ i, "latitude"); $ F8 name = mysql_result ($ result, $ i, "longitude"); $ F9 name = mysql_result ($ result, $ i, "address"); ? & Gt; & Lt; TR & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php echo $ f1; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php ek $ f2; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php echo $ f3; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php echo $ f4; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php echo $ f5; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php echo $ f6; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, non-serif" & gt; & Lt ;? Php echo $ f7; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php echo $ f8; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Font face = "ariel, helvetica, without-serif" & gt; & Lt ;? Php echo $ f9; ? & Gt; & Lt; / Font & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt ;? Php $ i ++; }? & Gt; Can anyone tell me why the records are not showing from the database? Any help will be very much appreciated.
It looks like you type variable $ f2- name though you $ F2 , along with $ f3 , $ f4 etc. If you want to keep your naming schema, you do it:
$ f2-name echo; Echo $ f3- name; // etc
Comments
Post a Comment