The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled PHP Code
Posted by: Tar | November 9, 2007 @ 9:37pm
PHP Code
[
Download
]
<html> <head> <basefont face="Arial"> </head> <body> <?php // set database server access variables: $host = "localhost"; // open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "SELECT * FROM symbols WHERE id='1' OR id='3' OR id='5'"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); echo "<table cellpadding=10 border=1>"; $data = while(mysql_fetch_array($result)){ $x = $data['id']; $myArray[$x] = $data; } echo "<tr>"; echo "<td>".$myArray[1]['id']."</td>"; echo "<td>".$myArray[1]['country']."</td>"; echo "<td>".$myArray[1]['animal']."</td>"; echo "</tr>"; echo "<tr>"; echo "<td>".$myArray[3]['id']."</td>"; echo "<td>".$myArray[3]['country']."</td>"; echo "<td>".$myArray[3]['animal']."</td>"; echo "</tr>"; echo "<tr>"; echo "<td>".$myArray[5]['id']."</td>"; echo "<td>".$myArray[5]['country']."</td>"; echo "<td>".$myArray[5]['animal']."</td>"; echo "</tr>"; echo "</table>"; // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?> </body> </html>
Syntax Highlighting
[
Open in new window
]
Author Comments
Have to actually loop it into those arrays, Danny!
Rating
4.49 / 8
269 Votes
http://codebin.yi.org/57
page generated in 0.00 seconds