I am new to PHP I am trying to create populated tables with data from a database near each row in the table Finally there should be a button in which there is a query string that identifies the name of "artist" and that individual artist needs to link to specific content, with my current table, the buttons are just repeated and this is not personal Ho Area, and do not know how they relate to what the artist how to query me.
& lt ;? Get Php // artist data $ result = mysqli_query ($ con, "SELECT * FROM artist LIMIT 10"); If (! $ Result) {printf ("Error:% s \ n", mysqli_error ($ con)); Go out(); } // show artist data "echo" in the table; Table & gt; & Lt; Th & gt; BadNoise artists & lt; / Th & gt; "; While ($ line = mysqli_fetch_array ($ result)) {resonant" & lt; Tr & gt; & Lt; Td & gt; ". $ Line ['first name']" & lt; / TD & gt; & Lt; TD & gt; ". $ Line ['Last name']" & lt; / Td> & Lt; Td> & Lt; Button & gt; Get external content & lt; / Button & gt; & Lt; / Td> & Lt; / Tr> ";} resounds" & lt; / Table> "; mysqli_close ($ thief);? & Gt;
I am using jQuery to populate a device that will display specific content for each artist:
& lt; script src = "http: // ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> & Lt; script & gt; $ (document) .ready (function () {$ ("button"). Click (function () {$ ("# div1"). Load ("demo_test.txt");} );}); & Lt; / script & gt;
something like this Let's move the artist ID to the ID field of the button Store it in trips and get it through junkie:
& lt;? Php // artist query to get the data $ result = mysqli_query ($ con, "SELECT * FROM artists LIMIT 10 "); if (! $ Result) {printf (" Error:% s \ n ", mysqli_error ($ con)); Exit ();} // Show artist data" echo "in table; Table & gt; ; & Gt; Bad & gt; BadNoise Artists & lt; / th & gt; "; While ($ line = mysqli_fetch_array ($ result)) {resonant "<<<< tr & gt; . $ Line ['first name'] "& lt; / td> gt; & lt; td & gt;" . $ Line ['Last name'] "& lt; / td> & lt; td & gt; & lt; button id = ''. $ Line ['artist']" '& gt; Get external content & lt; / Button & gt; & Lt; / Td> & Lt; / Tr> ";} resounds" & lt; / Table> "; mysqli_close ($ thief);? & Gt; & lt; script src =" http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js " Click & gt; & lt; / script & gt; script & gt; $ (document) .ready (function () {$ ("button") (function () {var artistId = $ (this). Attr ('id'); $ ("# div1"). Load ("Demo_test" + Artist id + ".txt");})}}; & lt; / script & gt;
Comments
Post a Comment