PHP - Unable To Display Image On Web Page
Hi,
I am a newbie to this forum and php as well. I have a script which inserts data and image file into mysql database. Now I want to display this image on web page but unable to do it. I tried a lot but couldn't find out any solution. I would appreciate your help. <?php $con = mysql_connect("localhost", "root", "xx"); if(!$con) { die('Could not connect:' .mysql_error()); } mysql_select_db("yyy",$con); $memberid = '$_POST[memberid]'; $fname = '$_POST[fname]'; $lname = '$_POST[lname]'; $gender= '$_POST[gender]'; $add1 = '$_POST[add1]'; $add2 = '$_POST[add2]'; $city = '$_POST[city]'; $state = '$_POST[state]'; $zip = '$_POST[zip]'; $country = '$_POST[country]'; $photo1 = '$_FILES[image][name]'; echo "$photo1"; //if ($memberid= $_GET['memberid']){ $query="select memberid,fname,lname,gender,add1,add2,city,state,zip,country,photo1 from vadhuvar_member where memberid =(select max(memberid)from vadhuvar_member)"; $result=mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $memberid = $row['memberid']; $fname = $row['fname']; $lname = $row['lname']; $gender = $row['gender']; $add1 = $row['add1']; $add2 = $row['add2']; $city = $row['city']; $state = $row['state']; $zip = $row['zip']; $country = $row['country']; //$photo1=chunk_split(base64_encode($photo1)); $photo1 = $row['photo1']; //echo base64_encode($photo1); echo "Name:$fname $lname<br>"; //echo "Name:$_POST[fname]$_POST[lname]<br>"; echo "Gender:$gender<br>"; echo "Address:$add1 $add2<br>"; echo "$city $state $zip<br>"; echo "$country<br>"; //echo "<img src=".upload/$photo1 ." alt="" width="200" height="300" /><br />"; } //} ?> <!--img src="<?php echo '.upload/$_FILES[image][name]?memberid=$row[memberid]'?>"alt="" width="200" height="300"/-->; <?php echo "<img src=". upload/$row[photo1]" alt="" width="200" height="300">";?> <!--img src="<?php echo ".\upload\$photo1" ?>" alt="" width="200" height="300"/-->; <? set_magic_quotes_runtime(1); // turn back on ?> Thanks Smita Similar TutorialsWould like to be able to click on a radio button that represents an image. Once selected and submitted, have that image display on another page. I have an idea, but need some guidance. BTW, is using php only doable? Is there a simpler or more elegant way to do this? Thanks all! ==> MySQL version 5.0.91-community So once upon a time I was working on a CMS. I worked on it for 3 months, had to wipe my computer - but didn't worry about it because I backed up the files on a flash drive... which got smushed by some boxes when I moved <.< awesome -.- Anyway, a year later (ie: today), I've decided to start again from scratch. For me - for whatever reason - the simplest things always seem to give me the most trouble. I decided to start with a "user" table - naturally - and began working on the first page: user_view.php and added an include file that connects to the database (connectDB.php). Since I started today, everything is simple - no design elements yet - just good 'ol code. The View Users Page is simply a page that grabs all the rows from Table: users and prints the information to the screen, as if you were viewing a Members page on a forum. This Page works fine. No complaints, does everything I need it to, prints all the rows and cols from Table Users. Then I created the Edit User Page. When I did this a year ago, and I wanted to print out all the data from the table, I used the while loop. When I wanted to only grab certain variables from a table, I just created a new set of variables, as show below. Using the same method from a year ago, I started working on printing various data to the screen (such as "Welcome $username"). 5 minutes of typing... refresh page... nada. So I stripped away just about every tag but the essentials and it still wouldn't work Code: [Select] <?php ... $userID = 3; $sql = "SELECT * FROM users WHERE userID='$userID'"; $result = mysql_query($sql); $rows = mysql_fetch_row($result); echo $rows['username']; ... ?> Normally, this would just grab the username from a row in Table users where the userID = 3 But instead - it does nothing. I just see a blank page. It's a simple 5 lines of code and it's like "im just gonna do w.e the fk i wanna do mmmk thxforplaying" PS: Keep in mind there is nothing wrong with the connection to the database, and as already stated I'm able to print ALL values from the Users Table using this same method: Code: [Select] <?php ... $user_sql = "SELECT * FROM users ORDER BY username ASC"; $user_result = mysql_query($user_sql); while ( $user_rows = mysql_fetch_array($user_result) ) ... ?> Hi all, Newbie here, i am having a problem to get my images to show which are stored in mysql database as a mediumblob. I get id number to print in table ut am just getting empty square with red cross in where my image should be. Is my code incorrect or is it something else? Appreciate your help with this. I have included both of the pages codes i am using. Thanks Tony image2.php <?php include("common.php"); error_reporting(E_ALL); $link = mysql_connect(host,username,password) or die("Could not connect: " . mysql_error()); mysql_select_db(db) or die(mysql_error()); $sql = "SELECT id FROM photos"; $result = mysql_query("$sql") or die("Invalid query: " . mysql_error()); ?> <table border="1"><tr><td>id</td><td>image</td></tr> <?php while($row=mysql_fetch_assoc($result)){ print '<tr><td>'.$row['id'].'</td><td>'; print '<img src="image1.php?id='.$row['id'].'height="75" width="100"">'; } echo '</td></tr></table>' ?> image1.php <?php ob_start(); include("common.php"); mysql_connect(host,username,password) or die(mysql_error()); mysql_select_db(db) or die(mysql_error()); $query = mysql_query("SELECT imgage FROM photos WHERE id={$_GET['image_id']}"; $row = mysql_fetch_array($query); $content = $row['image']; header('Content-type: image/jpg'); echo $content; } ob_end_flush(); ?> I am doing simple program to display text entered by user.. Following is my code but its display 'error msg' instate of txtbox contents <html> <head><title>Date</title></head> <body> <form action="" enctype="multipart/form-data"> Enter Date: <input type="text" name="txtdate"/> <input type="submit" value="Display"/> </form> </body> </html> <?php if(isset($_POST['txtdate'])) { $display =$_POST['txtdate']; echo 'You have entered'.$display; } else { echo 'Error msg'; } ?> This is my code is display my database (member_details) after user sign up but when a user register first name = <script>window.location="google.com"</script> This error occur=(The requested URL /yy2/html/google.com was not found on this server) Code: [Select] <?php session_start(); include ('includes/database_connection.inc.php'); $conn = connectDatabase(); if($_SESSION['uid'] == ''){ // redirect unauthenticate user to login page. header('Location: login.php'); } if($_GET['task'] == 'delete' && $_GET['id'] != ''){ // delete function here $sql="DELETE FROM Newest Where ID='".mysql_real_escape_string($_GET['id'])."'"; mysql_query($sql,$conn); header('Location: member_list.php'); } if($_POST['Logout']){ session_destroy(); header('Location: login.php'); } ?> <html><head><title>Member Details</title> </head> <body> <div style=" margin: 350px "> <?php $sql="SELECT * FROM Newest"; $rs = mysql_query($sql,$conn) or die( mysql_error() ); $list = "<table border=\"1\" cellpadding= \"2\">"; $list .= "<tr><th>First Name</th>"; $list .="<th>Last Name</th>"; $list .= "<th>User Name</th>"; $list .= "<th>Email</th>"; $list .= "<th>Edit User</th>"; $list .= "<th>Delete User</th>"; $list .= "<th>Change Password</th>"; While( $row = mysql_fetch_array($rs) ) { $list .= "<tr>"; $list .= "<td>".$row["name"]."</td>"; $list .= "<td>".$row["last"]."</td>"; $list .= "<td>".$row["user"]."</td>"; $list .= "<td>".$row["email"]."</td>"; $list .= "<td><a href='member_details.php?id=".$row['ID']."'>Edit</a></td>"; $list .= "<td><a onclick='return confirm(\"Are you sure to delete ".$row["name"]." \")' href='member_list.php?id=".$row["ID"]."&task=delete'>Delete</a></td>"; $list .= "<td><a href='Password.php?id=".$row['ID']."'>Click Here</a></td> </tr>"; } $list .= "</table>"; echo ( $list ); ?> <form method="post" action="member_list.php"><br> <div style="margin : 0px 600px"> <style type="text/css"> body {background:#F5F5F5 url('http://images.apple.com/downloads/dashboard/travel/images/traveltodolist_20070724165034.jpg') no-repeat top;; }</style> <input type="submit" name="Logout" value="logout" /> </form> </body> </html> MOD EDIT: [code] . . . [/code] BBCode tags added. I'm working on creating a Realtors website. Currently mysql DB has 4 tables. 3 of them are needed in this script to show up as 1 item. Table called Listings has 2 fields that call on 2 other tables. one is MLS which calls on the Images Table the other agent calls on the Agents table. I'm trying to see why I can't While loop all 3 tables together? How can I connect all 3? <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } //mysql_select_db($database_CarneyRealty, $CarneyRealty); //$query_Update1 = "SELECT * FROM listings"; //$Update1 = mysql_query($query_Update1, $CarneyRealty) or die(mysql_error()); //$rrows = mysql_fetch_assoc($Update1); //$totalRows_Update1 = mysql_num_rows($Update1); include 'dbc.php'; page_protect(); $err = array(); $msg = array(); $page_limit =4; //CHANGE FOR THE NUMBER OF LISTINGS PER PAGE! $page_num_limit =10; $ret = $_SERVER['HTTP_REFERER']; $host = $_SERVER['HTTP_HOST']; $host_upper = strtoupper($host); $login_path = @ereg_replace('admin','',dirname($_SERVER['PHP_SELF'])); $path = rtrim($login_path, '/\\'); // filter GET values foreach($_GET as $key => $value) { $get[$key] = filter($value); } foreach($_POST as $key => $value) { $post[$key] = filter($value); } $rs_all = mysql_query("select count(*) as total_all from listings") or die(mysql_error()); $rs_active = mysql_query("select count(*) as total_active from listings where status='ACTIVE'") or die(mysql_error()); $rs_total_contingent = mysql_query("select count(*) as tot2 from listings where status='CONTINGENT'"); $rs_total_pending = mysql_query("select count(*) as tot from listings where status='PENDING'"); $rs_total_sold = mysql_query("select count(*) as tot1 from listings where status='SOLD'"); $rs_resall = mysql_query("select count(*) as res from listings where class='Resident'") or die(mysql_error()); $rs_comall = mysql_query("select count(*) as com from listings where class='Commerical'"); $rs_farmall = mysql_query("select count(*) as farm from listings where class='Farmland'"); $rs_otherall = mysql_query("select count(*) as other from listings where class='Other'"); list($all) = mysql_fetch_row($rs_all); list($active) = mysql_fetch_row($rs_active); list($total_contingent) = mysql_fetch_row($rs_total_contingent); list($total_pending) = mysql_fetch_row($rs_total_pending); list($total_sold) = mysql_fetch_row($rs_total_sold); list($resall) = mysql_fetch_row($rs_resall); list($comall) = mysql_fetch_row($rs_comall); list($farmall) = mysql_fetch_row($rs_farmall); list($otherall) = mysql_fetch_row($rs_otherall); /////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// $sqlagents = mysql_query("select * from agents where id='$_SESSION'"); //$agentname= mysql_query($sqlagents) or die(mysql_error()); $sqllistings = mysql_query("select * from listings where id='$_SESSION'"); $sqlimages = mysql_query("select * from images where id='$_SESSION'"); //////////////////////////////////////////////////////////////////////////////////////////////////////// ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Search CarneyRealty Listings</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="../css/mm_brochure.css" type="text/css"> <style type="text/css"> <!-- body { background-image: url(http://www.carneyrealty.com/newsite/images/IMG_0161a.jpg); } .style1 { font-size: 16px } .style2 { font-family: Geneva, Arial, Helvetica, sans-serif } .style10 { font-size: 13px; font-weight: bold; color: #FF0000; } .style7 { color: #FF0000; font-weight: bold; } .style8 { color: #0000FF; font-weight: bold; } --> </style> </head> <body bgcolor="#bcbc85" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <div align="center"> <table width="81%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#999966"> <td width="25" nowrap="nowrap"><center> <img src="../images/mm_spacer.gif" alt="" width="15" height="1" border="0" /></td> <td height="60" colspan="3" class="logo" nowrap="nowrap"><div align="center"><img src="images/Carney_Logo1_000.jpg" width="630" height="158" /><br /> </div></td> <td width="4"></td> </tr> <tr bgcolor="#797947"> <td width="25" nowrap="nowrap"></td> <td colspan="3" valign="top"><div align="center"> <table width="460" border="0" cellpadding="0" cellspacing="0" id="navigation"> <tr> <td width="59" align="center" nowrap="nowrap"><div align="center"><a href="../index.htm" class="style1"><strong>HOME</a></div></td> <td width="127" align="center" nowrap="nowrap"><div align="center"><strong><a href="../SearchCarneyRealtyListings.php" class="style5">LISTINGSEARCH</a></strong></div></td> <td width="94" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Aboutus.html" class="style5">ABOUT US</a></strong></div></td> <td width="10" align="center" nowrap="nowrap"><div align="center"></div></td> <td width="95" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Community.htm" class="style5">COMMUNITY </a></strong></div></td> <td width="81" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Login.php" class="style5">LOGIN</a></strong></div></td> </tr> </table> <table width="307" border="0" cellpadding="0" cellspacing="0" id="navigation"> <tr> <td width="84" align="center" nowrap="nowrap"><div align="center"><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Resident" class="style1">Residential</a></div></td> <td width="103" align="center" nowrap="nowrap"><div align="center"><strong><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Commerical" class="style5">Commercial</a></strong></div></td> <td width="102" align="center" nowrap="nowrap"><div align="center"><strong><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Farmland" class="style5">Farms & Land</a></strong></div></td> <td width="18" align="center" nowrap="nowrap"><div align="center"></div></td> </tr> </table> <table width="573" border="0" cellpadding="0" cellspacing="0" id="navigation"> <tr> <td width="72" align="center" nowrap="nowrap"><div align="center"><a href="residental0-60.php" class="style1">$0-$60K</a></div></td> <td width="80" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental61-85.php" class="style5">$61K-$85K</a></strong></div></td> <td width="87" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental86-115.php" class="style5">$86K-$115K</a></strong></div></td> <td width="1" align="center" nowrap="nowrap"><div align="center"></div></td> <td width="103" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental116-160.php" class="style5">$116K-$160K</a></strong></div></td> <td width="93" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental161-230.php" class="style5">$161K-230K</a></strong></div></td> <td width="126" align="center" nowrap="nowrap"><div align="center"><strong><a href="residential231up.php" class="style5">$231K-And Up</a></strong></div></td> <td width="11" align="center" nowrap="nowrap"> </td> </tr> </table> </div></td> </tr> <td width="25" valign="top"><?php /*********************** MY MLS MENU **************************** This code shows MLS account menu only to logged in users. Copy this code till END and place it in a new html or php where you want to show myaccount options. This is only visible to logged in users *******************************************************************/ ?> <?php if(!empty($msg)) { echo $msg[0]; } ?> <? //$row_settings1=mysql_fetch_array($sqllistings1);?> <?php while ($row_settings1 = mysql_fetch_array($sqllistings)){ $row_settings2=mysql_fetch_array($sqlimages); $row_settings3=mysql_fetch_array($sqlagents); ?> <?php } ?> </table> <table width="81%" border="0" align="center" cellpadding="10" cellspacing="0" style="background-color: #FF9933;padding: 2px 5px;border: 1px solid #F90;" > <tr> <td height="44" align="center"><form name="form1" method="get" action="listingsearch.php"> <p> <input name="doSearch" type="submit" id="doSearch2" value="MLS Search" /> <input name="q" type="text" id="q" size="40"> <strong> S CARNEY& ASSOCIATES INC 800-757-5783</strong> <br> </p> </form></td> </tr> </table> </td> </tr> </table> </div> <p> <?php if ($get['doSearch'] == 'MLS Search') { $cond = ''; if($get['qoption'] == 'active') { $cond = "where `status`='ACTIVE' order by date desc"; } if($get['qoption'] == 'contingent') { $cond = "where `status`='CONTINGENT' order by date desc"; } if($get['qoption'] == 'pending') { $cond = "where `status`='PENDING' order by date desc"; } if($get['qoption'] == 'sold') { $cond = "where `status`='SOLD' order by date desc"; } if($get['qoption'] == 'resident') { $cond = "where `class`='Resident' order by price desc"; } if($get['qoption'] == 'farmland') { $cond = "where `class`='Farmland' order by price desc"; } if($get['qoption'] == 'commerical') { $cond = "where `class`='Commerical' order by price desc"; } if($get['qoption'] == 'other') { $cond = "where `class`='Other' order by price desc"; } //if($get['qoption'] == '') { if($get['q'] == '') { $sql = "select * from listings order by price asc"; // $sql = "select * from listings $cond"; // } } else { $sql = "select * from listings where `price` = '$_REQUEST[q]' or `mls`='$_REQUEST[q]' or `seller`='$_REQUEST[q]' or `class`='$_REQUEST[q]' or `status`='$_REQUEST[q]' order by `price` asc"; //$sql1="select * from images where `mls`='$sql'"; //$sql2="select * from agents where `tag`='$sql'"; // $sql = "select * from listings where `mls`='$_REQUEST[q]' or `price`='$_REQUEST[q]'"; } //$rs_total1=mysql_query($sql1) or die(mysql_error()); $rs_total = mysql_query($sql) or die(mysql_error()); $total = mysql_num_rows($rs_total); // $total1=mysql_num_rows($rs_total1); if (!isset($_GET['page']) ) { $start=0; } else { $start = ($_GET['page'] - 1) * $page_limit; } $rs_results = mysql_query($sql . " limit $start,$page_limit") or die(mysql_error()); $total_pages = ceil($total/$page_limit); // $rs_results1 = mysql_query($sql1 ."limit $start,$page_limit") or die (mysql_error()); ?> <?php // outputting the pages if ($total > $page_num_limit) { echo "<table width='81%' border='0' align='center' cellpadding='2' cellspacing='0' background='#fcfcdd'><span class='subHeader'><center>Pages: "; $i = 0; while ($i < $page_num_limit) { $page_no = $i+1; $qstr = ereg_replace("&page=[0-9]+","",$_SERVER['QUERY_STRING']); echo "<a href=\"listingsearch.php?$qstr&page=$page_no\">$page_no</a> "; $i++; } echo "</span></td></table>"; } ?> <? //while ($rrows3 = mysql_fetch_array($rrows3)){ ?> <form name "searchform" action="listingsearch.php" method="post"> </form> </table> <?php ////////////////////////////////////////////////////////////////////////////// while ($rrows = mysql_fetch_array($rs_results)) { $rrows2=mysql_fetch_array($sqlimages); $rrows3=mysql_fetch_array($sqlagents); /////////////////////////////////////////////////////////////////////////////// //$imagenamevar=($rrows['mls']=$rrows2['mls']); //echo $rrows3['id']; //$agentpicvar=($rrows['seller']=$rrow3['tag']); ?> <tr> <table width="81%" border="0" align="center" cellpadding="2" cellspacing="0" background="#fcfcdd"> <? echo $rrows['agents'.'seller_id'];?> <td width="161" height="211" align="center" valign="top" bgcolor="#fcfcdd"><div align="center"><img src="http://www.carneyrealty.com/newsite/uploads/<?php echo $rrows['mls'];?>/<? echo $mainimagevar; ?> width="214" height="160" /> </p> </div> <p class="tagline">Click for Additional Pictures</p></td> <td width="568" align="center" valign="top" bgcolor="#fcfcdd" class="calendarText"><div align="left"> <table width="592" height="180" border="1"> <tr valign="top"> <td width="74" height="27" bgcolor="#fcfcdd" class="tagline">Location </td> <td width="249" bgcolor="#fcfcdd"><strong><?php echo $rrows['location'];?> <br> <? echo $rrows['location1'];?> <br> <? echo $rrows3['tag'];?> </strong></td> <td width="180" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="center"> <table width="180" height="62" border="1"> <tr valign="top"> <td width="70" rowspan="2" class="tagline"><a href="http://www.carneyrealty.com/newsite/upload/<?php echo $rrows['mls'];?>/<? echo "SD_disp.pdf";?>"><img align="absbottom" src="http://www.carneyrealty.com/newsite/Listing_pages/images/datasheet_018.jpg" width="58" height="50" /></a></td> <td width="50" class="tagline"><div align="left">Status </div></td> <td width="68"><div align="right" class="subHeader"><?php echo $rrows['status']; ?></div></td> </tr> <tr valign="top"> <td height="24" class="tagline"><div align="left">PRICE</div></td> <td align="center" valign="top"><div align="right"><strong class="subHeader"><?php echo $rrows['price']; ?></strong></div></td> </tr> </table> <span style="color: #fcfcdd"><strong><a href="mailto:<? echo $rrows['selleremail'];?>"><img src="http://www.carneyrealty.com/newsite/Listing_pages/images/mail_004.gif" width="14" height="15" /><? echo $rrows['seller'];?></a></strong></span></div></td> <td width="61" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="right"></div> <span style="color: #fcfcdd"><img src="<? ///////////////////////////////////////////////////////////// while ($rrows3=($rrows['seller']=$rrows3['seller_id'])){ echo $rrows3['agentimage']; } ////////////////////////////////////////////////////////////// ?>" width="60" height="91" /></a></span></td> </tr> <tr valign="top"> <td height="64" bgcolor="#fcfcdd" class="tagline">Specs</td> <td bgcolor="#fcfcdd"><strong><?php echo $rrows['specs']; ?></strong></td> </tr> <tr valign="top"> <td height="77" bgcolor="#fcfcdd" class="tagline">Description</td> <td colspan="3" bgcolor="#fcfcdd" ><strong>MLS #<?php echo $rrows['mls'];?><br> <? echo $rrows['description'];?></strong> <p><strong>Call <? echo $rrows['seller'];?> at <? echo agentnumbervar;?> to view or for more information.</strong></p></td> </tr> </table> <tr> <td height="18" colspan="2" align="center" valign="top" bgcolor="#FF9933"><span class="bodyText style2" style="color: #fcfcdd"></span><span class="bodyText style2">S Carney & Associates Real Estate Brokerage 800 757 5783 </span></td> </tr> </div></td> </tr> </span> <? } ?> <td height="4"></td> </table> <? } ?> <? //} ?> </tr> <?php // outputting the pages if ($total > $page_limit) { echo "<table width='81%' border='0' align='center' cellpadding='2' cellspacing='0' background='#fcfcdd'><span class='subHeader'><center>Pages: "; $i = 0; while ($i < $page_num_limit) { $page_no = $i+1; $qstr = ereg_replace("&page=[0-9]+","",$_SERVER['QUERY_STRING']); echo "<a href=\"listings.php?$qstr&page=$page_no\">$page_no</a> "; $i++; } echo "</span></td></table>"; } ?> </td> </tr> <tr> <td height="22" class="bodyText"><? include 'footer1.shtml'; ?> </td> </tr> <tr> <td height="194" class="bodyText"><div align="center"> <table width="513" border="0"> <tr valign="top"> <th width="94" scope="col"><div align="center"><a href="http://www.realtor.org/technology/crt_secure/home?opendocument"><img src="images/index.1.gif" width="43" height="42" border="0" /></a></div></th> <th width="46" scope="col"><div align="center"></div></th> <th width="100" valign="middle" scope="col"><div align="center" class="style7"> <div align="center"><a href="http://www.nacogdochesmls.com/nag/passwd.php"><img src="images/MLS_a_94-50.gif" width="92" height="51" alt="Multiple Listing Service" /></a></div> </div></th> <th width="119" scope="col"><div align="center"><a href="http://www.hud.gov/offices/fheo/FHLaws/"><img src="http://www.habitatwhitley.org/equal_housing_logo.jpg" alt="Equal Housing Opportunity" width="60" height="62" border="0" /></a></div></th> <th width="129" scope="col"><div align="center"></div></th> </tr> <tr valign="top"> <td height="32"><div align="center" class="style8"><a href="http://www.realtor.org/technology/crt_secure/home?opendocument">REALTOR.ORG</a></div></td> <td><div align="center"></div></td> <td valign="middle"><div align="center"><span class="style10"><a href="http://www.nacogdochesmls.com/nag/passwd.php">Multiple Listing System</a></span></div></td> <td><div align="center"><strong><a href="http://www.hud.gov/offices/fheo/FHLaws/">Equal Housing Opportunity</a></strong></div></td> <td><div align="center"><a href="http://www.bbb.org/">BETTER BUSINESS BUREAU</a></div></td> </tr> </table> </div></td> </tr> </table> <div align="left"> <br /> </div> </div> </td> <td valign="top"><div align="left"></div></td> <td width="4"><div align="left"></div></td> </tr> <tr> <td width="15"> </td> <td width="35"> </td> <td width="698"><div align="center"> <?php include 'footer.shtml'; ?> </div> </td> <td width="1"><div align="center"></div></td> <td width="4"> </td> </tr> </table> </table> </table> </div> </body> </html> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=348417.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=321950.0 I wrote the page below to display a member's area of a website. The page is a mix of html and php code. the first part of is a block of php, which authenticates the user and displays the header. The middle part is a block of html which contains the bulk of the page. Embedded in this block of html are two sections of php, the first of which is supposed to display a user uploaded picture, enclosed in div tags, and the second of which, prints out the user's first name, from the database. The end of the script is a line of php that displays the footer. Now the page displays correctly when the section of php that contains the select query for displaying the picture(starting line 104) is omitted. But once I include that section, all i see is a blank page. Why is that section of php problematic? What can be done to fix it? Here is the data for the full page. Thanks for any help. <?php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); //authenticate user require('auth.php'); //define title define('TITLE' , 'Members'); require ('header.html'); //need the header ?> <div id="main" style="background-color: #FFFFFF; height:71%; width:101%; border:0px none none; margin:auto; "> <!-- --> <div id="main_left" style="float:left; height:100%; width:20%; border:0px none none;"> <!--opens main left--> <div id="main_left_top" style="float:left; position:relative;bottom:5px;right:5px; height:31.25%; width:100%; background-color: #FFFFFF; border:1px solid #c0c0c0; margin:1px;"> <!--opens main left top--> </div> <!-- closes main left top--> <div id="main_left_center" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left center--> <div id="main_left_bottom" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left bottom--> </div> <!-- closes main left--> <div id="main_center" class="content_text" style="float:left; height:100%; width:58%; background-color: #FFFFFF; border:1px solid #c0c0c0;"> <!--opens main center--> <div id="image_box" style="float:left; background-color: #c0c0c0; height:150px; width:140px; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <?php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); $query = "SELECT* FROM images WHERE member_id ='{$_SESSION['id']}' AND cartegoty 'main' "; $result = mysql_query($query); $result_data = mysql_fetch_array($result); header("Content-type: image/jpeg") ; echo $result_data['image']; ?> </div> <a href="upload_image_page.php">click here to uplaod a picture</a> <h1>Welcome <?php echo ucfirst($_SESSION['firstname']);?></h1> <a href="member_profile.php">My Profile</a> | <a href="logout.php">Logout</a> <p>This is a password protected area only accessible to members. </p> <a href="blog_entries.php">Add to Hahap Tok Library</a> </div> <!-- closes main center--> <div id="main_right" style="float:left; background-color: #FFFFFF; height:100%; width:20%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> <div id="main_right_top" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left top--> <div id="main_right_center" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left center--> <div id="main_right_bottom" style="float:left; background-color: #FFFFFF; height:34%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left bottom--> </div> <!-- closes main right--> </div> <!-- closes main--> <?php require('footer.html'); ?> Hi I have been trying to populate my data from 3 tables and display like this: DATE $acronym1 $acronym2 POSTS 1/9/2011 10 (this is no of posts) 3 POSTS 31/8/2011 20 10 and so on. the threads and user table will be similar as well. I am not able to populate the distinct dates since the dateline contains time as well. So when I try to print out the just dates(without time) , it prints with the dates repeated. it prints something like this: 1/9/2011 1 1/9/2011 1 and so on.. How can populate and print the the date and number of posts in the above format. Here is my complete code below: Code: [Select] <?php error_reporting(-1); //ini_set('display_errors',1); include("db.php"); //$thirty_days_ago = strtotime("-30 days"); $limit = strtotime("-1 month"); $sql=mysql_query(("SELECT * from new_site"),$con) or die(mysql_error()); while($row=mysql_fetch_assoc($sql)) { $include=$row['include']; $forumurl=$row['forumurl']; $url=$row['url']; $acronym=$row['acronym']; include("$include"); //echo $include."<br>"; $configdbname=$config['Database']['dbname']; $configdbconport=$config['MasterServer']['servername'].":".$config['MasterServer']['port']; $configusername=$config['MasterServer']['username']; $configpassword=$config['MasterServer']['password']; $configprefix=$config['Database']['tableprefix']; /* Connect to the required database */ $con2=mysql_connect($configdbconport, $configusername, $configpassword); if (!$con2) { die('Could not connect: ' . mysql_error()); } mysql_select_db($configdbname, $con2); $postdate=mysql_query("SELECT DISTINCT dateline,postid from post WHERE dateline >='$limit' ORDER by dateline DESC") or die(mysql_error()); while($postdate_results=mysql_fetch_assoc($postdate)) { $postdate_record=$postdate_results['dateline']; // echo $postdate."<br>"; $postdate_formatted=date('M dS Y ',$postdate_results['dateline']); $post_count=mysql_query("SELECT * from post WHERE dateline >='$postdate_record'"); while($post_count_results=mysql_fetch_assoc($post_count)) { //$postdate_formatted=date('M dS Y ',$post_dateline_results['dateline']); $posts=mysql_num_rows($post_count) or die(mysql_error()); //echo $acronym.":POSTS:".$posts."<br>"; echo '<table border="1">'; echo "<tr>"; echo "<th>Category</th>"; echo "<th>".$acronym."</th>"; echo "</tr>"; echo "<tr>"; echo "<td>POSTS:DATE:".$postdate_formatted."</td>"; echo "<td>".$posts."</td>"; echo "</tr>"; } $threaddate=mysql_query("SELECT * from thread WHERE dateline >='$limit' ORDER by dateline DESC") or die(mysql_error()); while($threaddate_results=mysql_fetch_assoc($threaddate)) { $threaddate_record=$threaddate_results['dateline']; $threaddate_formatted=date('M dS Y ',$threaddate_results['dateline']); $thread_count=mysql_query("SELECT * from thread WHERE dateline='$threaddate_record'"); while($thread_count_results=mysql_fetch_assoc($thread_count)) { $threads=mysql_num_rows($thread_count) or die(mysql_error()); //echo $acronym.":THREADS:".$threads."<br>"; echo "<tr>"; echo "<td>THREADS:DATE:".$threaddate_formatted."</td>"; echo "<td>".$threads."</td>"; echo "</tr>"; $userdate=mysql_query("SELECT * from user WHERE joindate >='$limit' ORDER by joindate DESC") or die(mysql_error()); while($userdate_results=mysql_fetch_assoc($userdate)) { $userdate_record=$userdate_results['joindate']; $userdate_formatted=date('M dS Y ',$userdate_results['joindate']); $user_count=mysql_query("SELECT * from user WHERE joindate='$userdate_record'"); while($user_count_results=mysql_fetch_assoc($user_count)) { $users=mysql_num_rows($user_count) or die(mysql_error()); //echo $acronym.":USERS REGISTERED:".$users."<br>"; echo "<tr>"; echo "<td>REGISTERED USERS::DATE:".$userdate_formatted."</td>"; echo "<td>".$users."</td>"; echo "</tr>"; } } } } } } echo "</table>"; ?> hi there, the code below is suppose to display something like the attachement "code2" but instead it displays something like attachement "code1" please assist in find what is wrong with my echo lines.
<?php $counter = 2; $sqlq="select * from state WHERE status = 0 "; $categorysqlq = mysql_query($sqlq); $varq = mysql_num_rows($categorysqlq); while($catfetchq = mysql_fetch_array($categorysqlq)) { $cnty = $catfetchq[0]; $sqllq="select * from vehicle WHERE country = '$cnty' "; $categorysqllq = mysql_query($sqllq); $numsql = "select * from branchaddr WHERE state = '$cnty' "; $numquery = mysql_query($numsql); $varqa = mysql_num_rows($numquery); $cntyfetchq= mysql_fetch_array($numquery); if($varq != 0){ if($counter == 2){ echo "<tr><td><a href=\"transport2.php?id=".$cntyfetchq['state'].">".$catfetchq[1]."(<span style=\"color:red\">".$varqa."</span>)</a></td>"; $counter--; } else{ echo "<td><a href=\"transport2.php?id=".$cntyfetchq['state'].">".$catfetchq[1]."(<span style=\"color:red\">".$varqa."</span>)</a></td></tr>"; $counter = 2; } } } ?>Attached Files code1.png 12.65KB 0 downloads code2.png 25.34KB 0 downloads Hi All. New at this, form is working perfect, then added recapthca, now it only handles recaptcha and not the form. not sure where the error is
I wonder whether someone may be able to help me please. I'm trying to put together a PHP within Aurigma Image Uploader which will create an image gallery. To do this I need to extract the image from a folder called 'Thumbnails' and image data from a file called 'files.xml'. The code below is an extract of the default script that performs this functionality and I've tested and it works without any issues. Code: [Select] <?php //This variable specifies relative path to the folder, where the gallery with uploaded files is located. //Do not forget about the slash in the end of the folder name. $galleryPath = 'UploadedFiles/'; $thumbnailsPath = $galleryPath . 'Thumbnails/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> I have now changed my folder and file structure to the following: UploadedFiles (Folder) username (Subfolder containing the 'location' folder) location (Subfolder containing 'Thumbnails folder and image, and 'files.xml') Please note that both the 'username' and 'location' folders are dynamically created when the user initially uploads the images. To try and accomodate the new file structure I changed my code to: Code: [Select] <?php //This variable specifies relative path to the folder, where the gallery with uploaded files is located. //Do not forget about the slash in the end of the folder name. $galleryPath = 'UploadedFiles/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $usernamefolder . DIRECTORY_SEPARATOR . $locationfolder . DIRECTORY_SEPARATOR; $thumbnailsPath = $galleryPath . 'Thumbnails/'; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> But when I run this I receive the following error: Quote d333603417/htdocs/development/UploadedFiles/files.xml" in /homepages/2/d333603417/htdocs/development/gallery.php on line 14 Line 14 is this line: Code: [Select] $descriptions->load($absGalleryPath . 'files.xml'); I've been working on this for days and I just can't seem to find the answer. I just wondered whether someone could possibly look at this and let me know where I'm going wrong. If it helps, I've added the upload script below. Code: [Select] <?php require_once 'Includes/gallery_helper.php'; require_once 'ImageUploaderPHP/UploadHandler.class.php'; $galleryPath = 'UploadedFiles/'; function onFileUploaded($uploadedFile) { global $galleryPath; $packageFields = $uploadedFile->getPackage()->getPackageFields(); $username=$packageFields["username"]; $locationid=$packageFields["locationid"]; $username = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['username']); $location = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['locationid']); $dirName = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['folder']); $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $username . DIRECTORY_SEPARATOR . $location . DIRECTORY_SEPARATOR; $absThumbnailsPath = $absGalleryPath . 'Thumbnails' . DIRECTORY_SEPARATOR; if (!is_dir($absGalleryPath)) mkdir($absGalleryPath, 0777, true); chmod($absGalleryPath, 0777); if (!is_dir($absGalleryPath . $dirName)) mkdir($absGalleryPath . $dirName, 0777, true); chmod($absGalleryPath . $dirName, 0777); if ($uploadedFile->getPackage()->getPackageIndex() == 0 && $uploadedFile->getIndex() == 0) initGallery($absGalleryPath, $absThumbnailsPath, FALSE); $originalFileName = $uploadedFile->getSourceName(); $files = $uploadedFile->getConvertedFiles(); $sourceFileName = getSafeFileName($absGalleryPath, $originalFileName); $sourceFile = $files[0]; if ($sourceFile) $sourceFile->moveTo($absGalleryPath . $sourceFileName); $thumbnailFileName = getSafeFileName($absThumbnailsPath, $originalFileName); $thumbnailFile = $files[1]; if ($thumbnailFile) $thumbnailFile->moveTo($absThumbnailsPath . $thumbnailFileName); $descriptions = new DOMDocument('1.0', 'utf-8'); $descriptions->load($absGalleryPath . 'files.xml'); $xmlFile = $descriptions->createElement('file'); // <-- please check the following line $xmlFile->setAttribute('name', $_POST['folder'] . '/' . $originalFileName); $xmlFile->setAttribute('source', $sourceFileName); $xmlFile->setAttribute('size', $uploadedFile->getSourceSize()); $xmlFile->setAttribute('originalname', $originalFileName); $xmlFile->setAttribute('thumbnail', $thumbnailFileName); $xmlFile->setAttribute('description', $uploadedFile->getDescription()); $xmlFile->setAttribute('username', $username); $xmlFile->setAttribute('locationid', $locationid); $xmlFile->setAttribute('folder', $dirName); $descriptions->documentElement->appendChild($xmlFile); $descriptions->save($absGalleryPath . 'files.xml'); } $uh = new UploadHandler(); $uh->setFileUploadedCallback('onFileUploaded'); $uh->processRequest(); ?> Many thanks Ive tried using header and form action and my page will not load into another page after submitting ! Any ideas?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Task2 - App</title> <meta name="description" content="The Task2 App"> <meta name="author" content="SitePoint"> </head> <body> <h1>Task 2 - Web App</h1> <br><br> <div class ="submission"> <form action="" method="POST" name='submit'> <label>N:</label> <input type="text" name="number-entered" id="number"/> <input name="form" type="submit" value="Submit"/> <br><br> </form> </div> </body> </html> <?php $number = $_POST['number-entered']; $form_result = $_POST['form']; if(isset($form_result)) { if(($number < 5) || ($number > 25)) { echo 'Input out of range'; } else { $number = $_POST['number-entered']; foreach ( range(1, $number) as $i ) { $triangle_numbers[] = $i * ( $i + 1 ) / 2; } //make a file $contents = fopen('gs://a1-task22020.appspot.com/triangular_' .$number. ".txt", "w"); fwrite($contents,implode(',', $triangle_numbers)); //open the file $contents = fopen('gs://a1-task22020.appspot.com/' . $content, 'w'); //re-open the document if you put something in it fwrite($contents, $number); fclose($contents); } } ?>
I wonder whether someone may be able to help me please. I've put together the following script which saves user defined images to server folders using the Aurigma Image Uploader software. Code: [Select] <?php require_once 'Includes/gallery_helper.php'; require_once 'ImageUploaderPHP/UploadHandler.class.php'; $galleryPath = 'UploadedFiles/'; function onFileUploaded($uploadedFile) { global $galleryPath; $packageFields = $uploadedFile->getPackage()->getPackageFields(); $username=$packageFields["username"]; $locationid=$packageFields["locationid"]; $usernamefolder = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['username']); $locationfolder = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['locationid']); $dirName = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['folder']); $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $usernamefolder . DIRECTORY_SEPARATOR . $locationfolder . DIRECTORY_SEPARATOR; $absThumbnailsPath = $absGalleryPath . 'Thumbnails' . DIRECTORY_SEPARATOR; if (!is_dir($absGalleryPath)) mkdir($absGalleryPath, 0777, true); chmod($absGalleryPath, 0777); if (!is_dir($absGalleryPath . $dirName)) mkdir($absGalleryPath . $dirName, 0777, true); chmod($absGalleryPath . $dirName, 0777); if ($uploadedFile->getPackage()->getPackageIndex() == 0 && $uploadedFile->getIndex() == 0) initGallery($absGalleryPath, $absThumbnailsPath, FALSE); $originalFileName = $uploadedFile->getSourceName(); $files = $uploadedFile->getConvertedFiles(); $sourceFileName = getSafeFileName($absGalleryPath, $originalFileName); $sourceFile = $files[0]; if ($sourceFile) $sourceFile->moveTo($absGalleryPath . $sourceFileName); $thumbnailFileName = getSafeFileName($absThumbnailsPath, $originalFileName); $thumbnailFile = $files[1]; if ($thumbnailFile) $thumbnailFile->moveTo($absThumbnailsPath . $thumbnailFileName); $descriptions = new DOMDocument('1.0', 'utf-8'); $descriptions->load($absGalleryPath . 'files.xml'); $xmlFile = $descriptions->createElement('file'); // <-- please check the following line $xmlFile->setAttribute('name', $_POST['folder'] . '/' . $originalFileName); $xmlFile->setAttribute('source', $sourceFileName); $xmlFile->setAttribute('size', $uploadedFile->getSourceSize()); $xmlFile->setAttribute('originalname', $originalFileName); $xmlFile->setAttribute('thumbnail', $thumbnailFileName); $xmlFile->setAttribute('description', $uploadedFile->getDescription()); $xmlFile->setAttribute('username', $username); $xmlFile->setAttribute('locationid', $locationid); $xmlFile->setAttribute('folder', $dirName); $descriptions->documentElement->appendChild($xmlFile); $descriptions->save($absGalleryPath . 'files.xml'); } $uh = new UploadHandler(); $uh->setFileUploadedCallback('onFileUploaded'); $uh->processRequest(); ?> This code saves the files in the following structu UploadedFiles (Pre-existing folder) 'username' (Subfolder created dynamically on image upload if it doesn't already exist. This folder contains the 'location' folder) 'location' (Subfolder created dynamically on image upload if it doesn't already exist. This contains original image, 'files.xml' and 'Thumbnails' folder) 'Thumbnails' (Subfolder created dynamically on image upload if it doesn't already exist. This contains thumbnail of original image) I'm now trying to put together a script which creates an image gallery, with those images pertinent to the current user and location. The code below is the piece of my script which deals with the loading of the images. Code: [Select] <?php $galleryPath = 'UploadedFiles/'; $thumbnailsPath = $galleryPath . 'Thumbnails/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> The initial problem I had, was resolved from guidance I received on this site, and that was to find the correct 'realpath' of the 'Thumbnails' folder and 'files.xml' These are as follows: Quote /homepages/2/d333603417/htdocs/development/UploadedFiles/IRHM73/1 and Quote /homepages/2/d333603417/htdocs/development/UploadedFiles/IRHM73/1/Thumbnails with 'IRHM73' being the 'username' value and '1' the 'location' value. The problem I now have lies within this line of code: `$absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR;` Because the 'username' and 'location' are dynamic and hence contain different values for each user and location, I've found it impossible to find a way of creating the correct file path to open the 'Thumbnails' folder and 'files.xml'. I had tried this: Code: [Select] <?php $galleryPath = 'UploadedFiles/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $usernamefolder . DIRECTORY_SEPARATOR . $locationfolder . DIRECTORY_SEPARATOR; $absThumbnailsPath = $absGalleryPath . 'Thumbnails' . DIRECTORY_SEPARATOR; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> But I receive the following error: DOMDocument::load() domdocument.load: I/O warning : failed to load external entity /homepages/2/d333603417/htdocs/development/UploadedFiles/'files.xml'; in /homepages/2/d333603417/htdocs/development/gallery.php on line 13 and line 13 is this: Code: [Select] $descriptions->load($absGalleryPath . 'files.xml'); I really am stumped with what to do next to get this to work. I appreciate that this is a fairly lengthy post, but thought it would be better to post all the information. I just wondered whether someone could perhaps take a look at this and let me know where I'm going wrong and how I can get it to work. Many thanks and regards Hello, Five images will be displayed inside a division. There will be a previous and next button/link. If someone click the next button the next image will be added in that div and the first image will be gone from that div. The previous button/link will do the same thing. Is it possible with php? I am confused if it's a javascript or ajax question. Thanks. Hey there I am having a problem where I am pulling the records for images from my database and then trying to display them. What happens is there are three images in the database and I want to display them. My code displays the images but it only shows two of the three. I know there are three images in the database I put them in and checked just to make sure. It just seems to only want to display two images instead of three. Here's the code:$getImages = "SELECT * FROM Images WHERE SKU = '".$sku."'"; $resultGetImages = mysql_query($getImages); $records = mysql_fetch_assoc($resultGetImages); ?> while($records = mysql_fetch_assoc($resultGetImages)){ echo "<a onclick=\"document.getElementById('placeholder').src='../../".$records['Path']."'\" target=\"_blank\"><img src=\"../../".$records['ThumbPath']."\" alt=\"".$records['Description']."\" height=\"".$records['ThumbWidth']."\" /></a>\n"; } ?> I have tried a for loop as well but it displayed more images than were in the database and just a single image over and over again. I know that was a flaw in my code and I'm not even sure a for loop would even be a reasonable way to go. Don't know if it is php or html but the image won't display. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" > <head> <meta name="google-site-verification" content="y_kspZkCZOQM-WGNB_lQ8BhJS8p7-B66hkHI_UhzKbs" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-language" content="en" /> <link type="text/css" rel="stylesheet" href="css/reset.css" /> <link type="text/css" rel="stylesheet" href="css/960.css" /> <link type="text/css" rel="stylesheet" href="css/custom.css" /> <title>Bay Area Remote Control Society</title> </head> <body> <div id="wrapper" class="container_12"> <div id="header" class="grid_12"> <div id="left-header" class="grid_5 alpha"><?php include('content/left-header.php'); ?></div> <div id="newsflash" class="grid_7 omega"><?php include('content/newsflash.php'); ?></div> </div> <div id="leftmenu" class="grid_3"><?php include('content/menu2.php'); ?></div> <div id="maincontent" class="grid_9"><?php include('content/maincontent.php'); ?></div> <div id ="footer" class="grid_12"><?php include('content/footer.php'); ?></div> </div><!-- end wrapper --> </body> </html> left-header.php Code: [Select] <?php ?> <img src="Pictures_Other/concorde.jpg" alt="concorde" border="0" width="250" height="188" /> |