Help with database queries

From: Date: Mon, 17 Sep 2001 17:37:31 +0000
Subject: Help with database queries
Groups: php.general 
Request: Send a blank email to php-general+get-67629@lists.php.net to get a copy of this message
Hi, need some help with the code below. I am thinking of reusing this for building a thumbnail gallery from a database. First, is the code actually good? Do i do something that will slow down the responses? Second, can anyone help me with a code sample to implement that will limit how many records the query is displaying? (break the database response into pages) Third, any good ideas on how to do this the easiest way is appreciated :) Thanks! - Daniel $db = mysql_connect("localhost", "xxx", "xxx"); mysql_select_db("xxx",$db); $result = mysql_query("SELECT * FROM film WHERE artnr LIKE '$avd'",$db); if ($myrow = mysql_fetch_array($result)) { echo "<TABLE cellSpacing=3 cellPadding=5 width=600 border=0>\n"; echo "<TR><TD><span class='text2'>Art.nr</span></TD>\n"; echo "<TD><span class='text2'>Titel</span></TD>\n"; echo "<TD><span class='text2'></span></TD></TR>\n"; do { printf("<TR><TD bgColor=#efefef><span class='text'>%s</span></TD> <TD bgColor=#efefef><span class='text'><b>%s</b></span></TD> <TD bgColor=#efefef><span class='text'>%smin</span></TD> </TR>\n", $myrow["artnr"], $myrow["titel"], $myrow["dur"]); } while ($myrow = mysql_fetch_array($result)); echo "</table>\n"; } else { echo "<span class='text2'>No records available...</span>"; } # Daniel Alsén | www.mindbash.com # # d@mindbash.com | +46 704 86 14 92 # # ICQ: 63006462 | #

« previous php.general (#67629) next »