menios Posted December 1, 2007 Share Posted December 1, 2007 Hi i need a way to display an image next to some results that are diplayed from my database. How can i upload/link my images with the results? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 1, 2007 Share Posted December 1, 2007 add a field for the image path/blob Quote Link to comment Share on other sites More sharing options...
menios Posted December 1, 2007 Author Share Posted December 1, 2007 how can i create a thumnail view of items and then a detailed view for each item and how to link those? So many questions.. sorry i m trying to learn and i know almost nothing ??? ??? Thanks for taking the time Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 1, 2007 Share Posted December 1, 2007 mysql database stores the data including the image path, html displays it maybe this will help you get started http://www.freewebmasterhelp.com/tutorials/phpmysql Quote Link to comment Share on other sites More sharing options...
menios Posted December 1, 2007 Author Share Posted December 1, 2007 well to start with smaller steps. how can i create a detailed view of a result diplayed? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 1, 2007 Share Posted December 1, 2007 what code do you have so far ? Quote Link to comment Share on other sites More sharing options...
menios Posted December 1, 2007 Author Share Posted December 1, 2007 This is what i display in an iframe from my index.html But it's just a display with no links.. [hr]<html> <body> <?php $bpp; //Books Per Page $apt; //Active page top $ppt; //Previous page top $a; //will be used to print the starting row number that is shown in the page $b; //will be used to print the ending row number that is shown in the page ///////////////////////////////////////////////////////////////////////////////// //Database connection ///////////////////////////////////////////////////////////////////////////////// $user="root"; $password="****"; $database="books"; $tablename="tbl_product"; $conn=mysql_connect("localhost",$user,$password); mysql_select_db($database) or die( "Unable to select database"); mysql_query($sql,$conn); $sql= "Select * from $tablename where cat_id='2'"; // return result of query to variable $result = mysql_query($sql); //Check for first load starting row should be 0. ///////////////////////////////////////////////////////////////////////////////// if(empty($_GET["apt"])) { $apt = "0"; } else { $apt = $_GET["apt"]; } ///////////////////////////////////////////////////////////////////////////////// $at = $apt+1; $bpp = "50"; $ppt = $apt - $bpp; //Calculating the starting row number for previous page ///////////////////////////////////////////////////////////////////////////////// //Check if we need Previous link enabled, if on the next set then it will carry the $ppt in its link and enable the link if ($apt <> 0) { $prv = "<a href='fiction.php?apt=$ppt'>Previous</a>"; } else { $prv = "<font color='cccccc'>Previous</font>"; } ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // calculate total number of rows found by the query excluding the limit function added at the end of the SQL statement $q="Select SQL_CALC_FOUND_ROWS * from tbl_product where cat_id='2' limit $apt, $bpp"; $rs=mysql_query($q) or die(mysql_error()); $nr = mysql_num_rows($rs); //Number of rows found with LIMIT in action //FOUND_ROWS function which actually gives out the number of rows found. $q0="Select FOUND_ROWS()"; $rs0=mysql_query($q0) or die(mysql_error()); $row0=mysql_fetch_array($rs0); $nr0 = $row0["FOUND_ROWS()"]; //Number of rows with no limitation //Check if we reached the end if (($nr0 < 10) || ($nr < 10)) { $b = $nr0; } else { $b = ($apt) + $bpp; } ///////////////////////////////////////////////////////////////////////////////// ?> <!--Create the table and decorate it --> <br> <table border="1" cellpadding="4" cellspacing="1" width="95%" align="center"> <tr><td bgcolor="#000080" align='Center'><b><font face="verdana" color="#FFFFFF">Title</font></b></td> <td bgcolor="#000080" align='Center'><b><font face="verdana" color="#FFFFFF">test</font></b></td> </tr> <?php while ($row=mysql_fetch_array($rs)) { //Start displaying results from DB and increment so that we can get the next page' when it exits the while //loop after fullfilling the above SQL criteria. ///////////////////////////////////////////////////////////////////////////////// $apt = $apt +1; $val=$row["pd_name"]; //fields to show $val2=$row ["pd_price"]; echo "<tr><td width='10%' align='center'><font face=verdana><img src='images/fiction.png' ></font></td><td align='center'><font fave=verdana>$val $val2 £</font></td></tr>"; } echo "<tr><td align='right' colspan=2>$prv"; //Check whether there is a Next link if not disable if ($apt == $nr0) { echo " | <font color='CCCCCC'>Next</font>"; } else { if ($nr0 > 5) { echo " | <a href='fiction.php?apt=$apt&ppt=$ppt'>Next </a>"; } } ?> </td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.