PHP - How Can I Display Images In A Series Of Div Or In Table Cell?
Image name will come from database.
It can be displayed in divs or table cells. Which is better using divs or table cells? Can anyone post sample code? http://img28.imageshack.us/i/44233003.png/ Similar TutorialsOk the pagination part is all working fine. but i thought id be able to create a heap variables inside the loop then display the images in a table. the only trouble is all variables are grabbing the same img. i need them to grab the 10 different records. thanks Code: [Select] $sql = "SELECT * FROM mongrels_db.gallery ORDER BY id DESC LIMIT $offset, $rowsperpage "; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); // while there are rows to be fetched... while ($list = mysql_fetch_array($result)) { $img1=$list['img']; $img2=$list['img']; $img3=$list['img']; $img4=$list['img']; $img5=$list['img']; $img6=$list['img']; $img7=$list['img']; $img8=$list['img']; $img9=$list['img']; $img10=$list['img']; // echo data } // end while echo "<table><tr>"; echo "<td>"."<img src='../gallery/".$img1 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img2 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img3 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img4 ."' width='100' height='100''> "."</td></tr>"; echo "<tr><td>"."<img src='../gallery/".$img5 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img6 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img7 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img8 ."' width='100' height='100''> "."</td>"; echo "<tr><td>"."<img src='../gallery/".$img9 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img10 ."' width='100' height='100''> "."</td></tr>"; Hi, here's my problem: I am trying to make a simple online buying website and I want to display a table with all the fields for each item. So I got that part down which is to just use mysql_fetch_assoc("SELECT * FROM myTable") and use the html table tags stuff, but now I want to display my images in the table, so here's my code to display my mysql database table in html's table tag along w/ php: <html> <head> <title>My Online buying website project</title> </head> <body> <?php mysql_connect("localhost","root"); mysql_select_db("myTable"); $imagesArray=array("Apple_iPhone3GS.jpg","Apple_iPhone4.jpg","product3.jpg","product4.jpg","product5.jpg"); $result=mysql_query("SELECT Name, Manufacturer, Price, Description, SimSupport FROM myTable"); if(mysql_num_rows($result))//if there is at least one entry in bellProducts, make a table { print "<table border='border'>"; print "<tr> <th>Name</th> <th>Manufacturer</th> <th>Price</th> <th>Description</th> <th>SimSupport</th> </tr>"; //NB: now output each row of records while($row=mysql_fetch_assoc($result)) { extract($row); print "<tr> <td>$Name</td> <td>$Manufacturer</td> <td>$Price</td> <td>$Description</td><td>$SimSupport</td> </tr>"; }//END WHILE }//END IF ?> </table> </body> </html> *So how do I go about adding my images in this table? Hi guys. Just a quick PHP question. I have a script running that gets the files from a directory. There is then a switch function that decides what to do with the file, ie... if it is a PNG... DO THIS.. if it is a docx... DO THIS.. etc. And i want each file to be in a different cell on the table. The table can be longer wider than 5 columns (however it can be as high as it wants). I currently have this bit working... but instead of one item in each cell... it is displaying every item in each cell. Any ideas Chaps? Here is my code Many thanks in advance if you could possibly help.. echo "<table><tr>"; $count = count(glob("../../shared/files/*.*", GLOB_BRACE)); for($i=1; $i <= $count; $i++) { /// echo "<td>"; /// if ($handle = opendir('../../shared/files/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $break = pathinfo($file); $b = $break['extension']; switch (@$break[extension]) { case 'bmp' : echo 'A BMP<br>'; break; case 'png' : echo 'A PNG<br>'; break; case 'doc' : case 'docx' : echo 'A DOC OR DOCX<br>'; break; default: echo 'FILE NOT RECOGNISED<br>'; } } } closedir($handle); } /// echo "</td>"; /// if($i % 3 == 0) echo "</tr><tr>"; } echo "</tr></table>"; ?> I have this script from http://lampload.com/...,view.download/ (I am not using a database) I can upload images fine, I can view files, but I want to delete them. When I press the delete button, nothing happens
http://www.jayg.co.u...oad_gallery.php
<form>
<?php $dir = dirname(__FILENAME__)."/images/gallery" ; $files1 = scandir($dir); foreach($files1 as $file){ if(strlen($file) >=3){ $foil = strstr($file, 'jpg'); // As of PHP 5.3.0 $foil = $file; $pos = strpos($file, 'css'); if ($foil==true){ echo '<input type="checkbox" name="filenames[]" value="'.$foil.'" />'; echo "<img width='130' height='38' src='images/gallery/$file' /><br/>"; // for live host //echo "<img width='130' height='38' src='/ABOOK/SORTING/gallery-dynamic/images/gallery/ $file' /><br/>"; } } }?> <input type="submit" name="mysubmit2" value="Delete"> </form>
any ideas please?
thanks
I am having a problem trying to show if cell is empty echo one thing if empty and starttime if there is one: Code: [Select] if(isset($rown['starttime'])) { echo "Add Day"; } else { echo $rown['starttime']; } This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=355480.0 I am trying to insert data from a mysql in a table. I want the data to appear with the image on the left, item name on the top right followed by description underneath. <?php $sql = 'SELECT * FROM tbl_products ORDER BY id'; $result = $db->query($sql); $output[] = '<ul>'; $output[] = '<table border="3" bordercolor="#000000">'; while ($row = $result->fetch()) { $output[] = '<tr>'; $output[] = '<td><img src="images/'.$row['pic'].'" width="67" height="100" /></td>'; $output[] = '<td class="style10"><strong>'.$row['item_name'].'</strong></td>'; $output[] = '<td>'.$row['item_description'].'</td>'; $output[] = '</tr>'; } $output[] = '</table>'; echo join('',$output); ?> I would like the items to appear the same way as this page http://aafcollection.info/items/list.php Trying to run this function so it displays the generated image in a table cell - Code: [Select] <?php function imgsecuregen($size = 6){ $width = 11*$size; $height = 25; $string = ""; for($i = 1; $i <= $size; $i++){ $string .= rand (0,9).""; } // for $im = ImageCreate($width, $height); $bg = imagecolorallocate($im, 102, 102, 102); // background $black = imagecolorallocate($im, 0, 255, 0); // text $grey = imagecolorallocate($im, 102, 102, 102); // border imagerectangle($im,0, 0, $width-1, $height-1, $grey); imagestring($im, 5, $size, 5, $string, $black); imagepng($im); imagedestroy($im); } imgsecuregen(8); // string length ?> Works if I load it directly, but not in a <td>. Hi guys i have another question about my shopping cart.
I have in my sql database table called products. It consist of 4 columns (product_id, description, quantity, price).
Now on my index page, I want to call just one product from cell, which would have special price. But i don't know how to call one single product.
So my code looks like that:
<?php $sql="SELECT product_id FROM Products"; $query=mysql_query($sql); $row=mysql_fetch_array($query); ?><table > <tr><img src="Images/Image.jpg" width="380" height="300" /> </tr> <tr> <td><a href="index.php?page=index&action=add&id=<?php echo $row['product_id']?>">Add to cart</a></td> </tr> <?php ?> </table>This code display me first product but i would like to call 3 product how would i do that, so i have 6 products and i would like to call product N.3 to my index page. My code calls the first one, how would it call the third. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=314271.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=307147.0 how to format only one specific row based on the value of one cell in a row? $result = mysql_query(select bal, etc. etc ..query ) while($row = mysql_fetch_assoc($result)) echo "<tr>"; echo "<td>" . $row['Account'] . "</td>"; echo "<td>" . $row['licence'] . "</td>"; echo "<td>" . $row['own'] . "</td>"; echo "<td>" . $row['bal'] . "</td>"; echo "</tr>"; Would appreciate help on how to format only the $row['bal'] output to red colour IF bal >5000 Thanks Hi I have a table that populated by a recordset, and wondered whether is was possible to make a row background colour = red where a particular cell = some text? I have been searching around and not managed to find anything of use. Any help would be appreciated.
When I echo out my variable in the php file it works fine but when I put the variable in a table cell it doesn't echo out. I have a stdClass Object array with nested User arrays as a value that I would like to display in a table cell. I am struggling and have exhausted a lot of time. I am hoping to get a shove in the right direction if possible. The image below will show what I am trying to do.
$someArray = json_decode($token_result); foreach ($someArray as $key => $value) { $combined[] = "<tr><td>" . $value->customer . "</td><td>" . $value->city . '</td> <td>' . $value->state . "</td><td>" . $value->zipcode . '</td> <td>' . $value->totalUsers . "</td><td>" . $value->totalActiveUsers . "</td><td>" . $value->totalInActiveUsers . '</td><td> <a href="">' . $value->users . "</a></td></tr>"; } foreach ($combined as $value) { print $value; } Here is what my Array and Objects look like Array ( [0] => stdClass Object ( [customer] => SWSH [city] => Thomasville [state] => GA [zipcode] => 31792 [totalUsers] => 6 [totalActiveUsers] => 6 [totalInActiveUsers] => 0 [users] => Array ( [0] => stdClass Object ( [firstName] => xxx [lastName] => xxx [phoneNumber] => [userName] => cb_igwrth@xxx.com [createdBy] => [isActive] => 1 ) [1] => stdClass Object ( [firstName] => Dan [lastName] => Stewart [phoneNumber] => +11111111111 [userName] => dan.sxx@xxx.ga.gov [createdBy] => kwilliams@xxx.com [isActive] => 1 ) ) ) [1] => stdClass Object ( [customer] => xxxx [city] => Carver [state] => MA [zipcode] => 02330 [totalUsers] => 3 [totalActiveUsers] => 3 [totalInActiveUsers] => 0 [users] => Array ( [0] => stdClass Object ( [firstName] => Leo [lastName] => Furtado [phoneNumber] => 781-000-0000 [userName] => LFurtado@xxx.com [createdBy] => TConger@ccccc.com [isActive] => 1 ) ) ) ) Table is attached
Hi everyone, I have a gateway and I can submit 200 max at one time using POST. I need to send around 200,000 at a time. So, in a nut shell, I need to submit 1,000 POST without actually refreshing my page. How can I do that ? Becuz once I submit a POST, the page on my browser goes to the gateway page rather than staying on the current page. So, what I need is something like click one button do 1,000 POST and send around 200,000. Looking forward to receiving any input on this. Thanks all. Regards I want to display thumbnails for a picture gallery and when user clicks on image the larger image opens in a new window. I can't find a straight answer on the php.net website. Can someone help? I am looking to display image paths in a row separated by commas. There are 6 images that goes to each user and I would like only the 6 images at be in each " " Like this: "images/listings/listing_516013019A-only.jpg,images/listings/listing_848813453A-1.jpg,images/listings/listing_664613453A-2.jpg,images/listings/listing_520313453A-3.jpg,images/listings/listing_690513453A-4.jpg,images/listings/listing_125113453A-5.jpg,images/listings/listing_641013453A-6.jpg," "images/listings/listing_736913186A-1.jpg,images/listings/listing_822713186A-2.jpg,images/listings/listing_136513186A-3.jpg,images/listings/listing_700313186A-4.jpg,images/listings/listing_716013186A-5.jpg,images/listings/listing_213113186A-6.jpg," "images/listings/listing_292113254A..-1.jpg,images/listings/listing_854413254A..-2.jpg,images/listings/listing_446013254A..-3.jpg,images/listings/listing_676313254A..-4.jpg,images/listings/listing_563413254A..-5.jpg,images/listings/listing_341513254A..-6.jpg," Right now it is displaying them like this "images/listings/listing_516013019A-only.jpg," "images/listings/listing_848813453A-1.jpg," "images/listings/listing_664613453A-2.jpg," "images/listings/listing_520313453A-3.jpg," "images/listings/listing_690513453A-4.jpg," "images/listings/listing_125113453A-5.jpg," "images/listings/listing_641013453A-6.jpg," "images/listings/listing_736913186A-1.jpg," "images/listings/listing_822713186A-2.jpg," "images/listings/listing_136513186A-3.jpg," "images/listings/listing_700313186A-4.jpg," "images/listings/listing_716013186A-5.jpg," "images/listings/listing_213113186A-6.jpg," "images/listings/listing_292113254A..-1.jpg," "images/listings/listing_854413254A..-2.jpg," "images/listings/listing_446013254A..-3.jpg," "images/listings/listing_676313254A..-4.jpg," "images/listings/listing_563413254A..-5.jpg," "images/listings/listing_341513254A..-6.jpg," Here is the code I have: Code: [Select] <?php // Make a MySQL Connection mysql_connect("localhost", "xxxxxxxx", "xxxxxxxx") or die(mysql_error()); mysql_select_db("xxxxxxxx") or die(mysql_error()); $result = mysql_query("SELECT * FROM listimages ORDER BY listimages.listingid DESC ") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "\""; echo "$row[imagepath],"; echo "\""; echo "<br>"; } ?> My tables for the images is "listimages" and the columns a id (which are the auto_increments) imagepath (which shows the path/image1.jpg) mainimage (which just shows 0 or 1 depending on the picture that is the default for that listing, 1 being default) listingid (shows numbers 1 2 3 etc corresponding to the Id in the listings table to show what images go with what listing) There are up to 6 images for each listing. Any idea how to fix this? I'm creating a funeral home site and on the side of the page I would like to display the last 5 funeral obituaries that are in mySQL database (name and certain sized image (images are in "image" field) w/ a link to an "obituaries detail page for the individual deceased person"). I am able to do this successfully listing only the names....how can I list the image associated with the name? This is what I have so far: Code: [Select] <?php include("connect.php"); ?> Code: [Select] <?php $query = "SELECT id, deceased_name, deceased_date, DATE_FORMAT(deceased_date, '%M %D, %Y') as datetext"; $query .= " FROM scales_obits ORDER BY deceased_date DESC LIMIT 5"; $listings = mysql_query($query); if (!listings) { echo("<p>Error retrieving listings from lookup table<br>". "Error: " . mysql_error()); exit(); } echo("<table border=\"0\" width=\"100%\" class=\"obit\">"); while ($listing = mysql_fetch_array($listings)) { $deceased_name = $listing["deceased_name"]; $deceased_date = $listing["datetext"]; $id = $listing["id"]; echo("<tr><td width=\"100%\"><a href=\"obitdetail.php?id=".$id."\"><strong>".$deceased_name."</strong></a></td><td> </td>"); } echo("</table>"); ?> |