PHP - Click Image To Reveal Dynamic Content Help?
Hi, I currently have this code which displays text on clicking the image:
<a href="javascript:;" onclick="document.getElementById('text').style.display='block';window.open('url...');"><img src="image..."></a> <div id="text" style="display:none;"> ...text to be displayed here </div> it works fine but I want to integrate this with php which is where I am struggling. I have a mySQL database with 4 fields (id;name;description;url), what i would like to do is name the div to be opened on click with the 'id' field from the database so that it would become '<div id="id"> and then more than one function could be implemented on each page. I would also like to replace '...text to be displayed here' with the field 'name' from the database and '...url' with the field 'url from the database. Any help would be very much appreciated. Thanks in advance. Similar TutorialsHi there, I have a simple question - is it possible to send out an html email containing PHP/MySQL code so that when the user receives the email it checks the date and serves up content from a database? I have created a page that works fine online, but when I try to email the page, it doesn't work from within the user's email client (such as outlook, or gmail). When I look at the raw email source, it looks like the PHP code isn't getting executed by the email program. If anyone knows a reason or workaround, I would appreciate it! Thanks in advance, Rick Code: [Select] <?php $day = date("Y-m-d"); // Connects to your Database mysql_connect("empowermentoftheday.com", "username", "password") or die(mysql_error()) ; mysql_select_db("etd_emails") or die(mysql_error()) ; if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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; } } $query = sprintf("SELECT * FROM daily WHERE date = '%s'", mysql_real_escape_string($day)); // Perform Query $Recordset1 = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$Recordset1) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Free inspirational Picture of the Day as well as a Free daily Wellness Break. Start your day off right and Empower Yourself Today. Empowerment of the Day is meant to inpire you each and every day and is brought to you by the Remakable Success Group Team.Empower Yourself Today." /> <meta name="keywords" content="inspirational quote, picture of the day, wellness quote, inspirational saying, inspirational story, today's wellness break, empowerment, empower yourself, empowerment of the day, health tip, wellness tip" /> <title>Empowerment Of The Day</title> </head> <body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="100%" align="center"> <div style="background:#DBAE13"> <img src="http://www.empowermentoftheday.com/email/images/header.jpg" alt="Empowerment of the Day" width="650" height="77" /></div> <div> <table width="650" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"><img src="http://www.empowermentoftheday.com/email/images/message2.jpg" alt="Picture of the Day" width="306" height="34" vspace="15" /></td> </tr> <tr> <td align="center" valign="middle"> <table border="0" cellspacing="0" cellpadding="5" bgcolor="#000000"> <tr height="10px"> <td height="10px"></td> <td height="10px"></td> <td height="10px"></td> </tr> <tr> <td> </td> <td><img src="http://www.empowermentoftheday.com/email/images/photos/<?php echo $row_Recordset1['photo']; ?>" alt="Picture of the Day" /></td> <td> </td> </tr> <tr> <td> </td> <td align="center"> <div><font color="#FFFFFF" face="Helvetica, Arial, sans-serif"><?php echo $row_Recordset1['quote']; ?></font></div> </td> <td> </td> </tr> </table> </td> </tr> <tr> <td align="center" valign="middle"> <img src="http://www.empowermentoftheday.com/email/images/message3.jpg" alt="Today's Wellness Break" width="360" height="44" vspace="15" /></td> </tr> <tr> <td align="center" valign="middle"><p><font color="#000000" face="Helvetica, Arial, sans-serif"><?php echo $row_Recordset1['wellness']; ?><br> <br> </font></p></td> </tr> </table> <script language="JavaScript1.2" type="application/javascript"> /* Disable right click script II (on images)- By Dynamicdrive.com For full source, Terms of service, and 100s DTHML scripts Visit http://www.dynamicdrive.com */ var clickmessage="Right click disabled on images!" function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } } function associateimages(){ for(i=0;i<document.images.length;i++) document.images[i].onmousedown=disableclick; } if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages() </script> </div> <div style="background:#D0A615"> <img src="http://www.empowermentoftheday.com/email/images/footer.jpg" alt="Copyright 2010 Remarkable Success Group Inc. Design by Ortega.ca" width="650" height="74" border="0" usemap="#Map" /> <map name="Map"><area shape="rect" coords="456,28,617,55" href="http://www.ortega.ca" alt="Design by Ortega.ca" target="_blank"></map> </map></div> <!-- GOOGLE ANALYTICS --> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2910054-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </td> </tr> </table> </body> </html> <?php mysql_free_result($Recordset1); ?> Folks, I need help (Php code ) to generate a Dynamic Text on a Base Image. What i want to do is, to make this Image as header on my Site and to make this Header Specific to a Site, i want to Add the Domain Name on the Lower Left of the Image. Got the Idea? Here is the Image link: Quote http://img27.imageshack.us/i/shoppingheader1.jpg/ PHP Variable that holds the Domain name is: $domain All i need the Dynamic PHP Codes that i can put on all my sites to generate this Text on Image (Header) Dynamically... May Anyone Help me with this Please? Cheers Natasha T. Hello friends,
I am trying to achieve a simple thing, but I do not know jquery/javascript much. When I click on a forst list item in one div , I want to show corresponding 1st li in the second div. I have 6 list items in total and related 6 li in second div.
Also when I click on any list item in first div, it will be borderd, this I achieved. But I am not able to bring the related li in the second div.
Hope I make myself clear.
Here is my code
<style> .selected img { border:2px solid #090; } .visible { display:block; } .invisible { display:none; } </style> <div id="all"> <ul> <li class="selected"><img src="image1.JPG" /></li> <li><img src="image2.JPG" /><br /></li> <li><img src="image3.JPG" /><br /></li> </ul> </div> <div class="container"> <ul> <li class="visible"><img src="related_image1.JPG" /></li> (In these list items there may be img or content) <li class="invisible"><img src="related_image2.JPG" /></li> <li class="invisible"><img src="related_image3.JPG" /></li> </ul> </div> <script type="text/javascript"> $('#all ul li').on('click', function(){ $(this).addClass('selected').siblings().removeClass('selected'); $('.container ul li:nth-child(1)').fadeout(); // Don't know this line is correct or not }); </script>Any help guys ? Edited by Jaswinder, 19 July 2014 - 08:57 PM. Hi, I have some files stored in mysql db. I have created a web page which shows the list of tutorials from db. at first i was creating a separate php page for each tutorial, but later i have decided that it would be easier and simpler if i can create one php page and whenever i click the tutorials it will change the content of this page. example: when i click "tut002" from list. it will change the content of tutorials.php . I have these tutorials in .html format here is the code i have in turorials.php once again, whenever i click a tutorial this include part needs to change automatically to whatever i click Code: [Select] echo '<div class="content">'; include ("inc/tut001.html"); echo '</div>'; it will be really appreciated if you have a sample code for this. sorry for my english. thank to whoever interested in this matter. Is there a way to create dynamic content without the use of a Content Management System? I simply want to click on a link in my navigation menu and have that display the content in a div section and keep the content in a separate folder on the server. I didnt want to have to use a CMS to accomplish that because every other feature of it will be unused as I just simply want to display the content in a div when I click on the link. I use a simple test server on my Home PC that I use to format the articles in html from documents I have wrote in LibreOffice, so I dont really need all the features and sophistication of full blown CMS. But I also dont want a bunch of different files in my root folder if I can avoid it. I would rather keep the content in a separate folder and just pull it from there and display it on the main page when the link is clicked. Anyway, I dont know if its even possible or if its the best way, so I am open to suggestions as well. Some of the documents are quite long (like several chapters) and some are much shorter (just a few pages). Any help and ideas are much appreciated. Hello Im trying to work out how i can display 2 sets of dynamic content depending on a link clicked. Im currently using css, html, php & mysql. I have my database set with a unique id for each row of data. Heres what i am trying to get to work. I have links in div1 that pull info depending on different fields and display it in div2 (eg link 'title' will pull down the 'title' field, link 'author' would pull down the 'author' field) the info displayed in div2 is a series of dynamic links that i want to display the content of that row in div3 (eg the link 'title' 'math' would display all content from its row using the unique id) i am able to set up the links (div1) to display content in div2 and the div2 dynamic links to display content in div3. But when ever i click a dynamic div2 link it displays the info in div3(like it should) but div 2 reverts back to default(which it shouldnt). how can i display the div2 dynamic links while displaying div3 content? ive tried using a switch statement and also a form action statment ( if(action == title){display info}; ) is there something i can try to get this to work... i know it can be done using html frames but i want to stay away from frames as they are just crap (well i think they are) any help or advice would be great. cheers P0PZ ps. i hope i have explained what im trying to achieve ok... if i havent just let me know and ill try again. Hey everyone, I'm new to web programming so I thought I would join a active community to help me out. Anyhow, I'm making a game portal and I want the users games to have a url like so... games/username/gamename. From what I understand I could get this structure by simply using data from my login session(username) and using my upload form(gamename) and mkdir. Then I would need to have an index page inside every gamename folder? How would I add the index pages inside such folders. This way seems pretty inefficient to do considering I could pull the games dynamically in a single php file. Is there a way I can make my url look nice and still use one file to handle the embedding of the games, comments etc. Thanks Firstly, I'd just like to say hello, seeing as this is my first post. I've had a look about and I think I'm going to enjoy my stay here. Now, here's my problem. I'm using $_GET to power dynamic-content. Code: [Select] <?php //creates page variable $page = isset($_GET['page']) ? $_GET['page'] : 'home'; ?> Code: [Select] <?php //checks if there is content for the chosen if(file_exists('content/'.$page.'.php')) { //if there is, it is included include('content/'.$page.'.php'); } else { if(file_exists('content/404.php')) { //if their wasn't any content include('content/404.php'); } } ?> So say, for example, I have "Hello World!" in a file called helloworld.php and I go to websiteurl.com/helloworld (I've set up .HTACCESS to ignore "index.php?page=") The "Hello World!" would display fine. The problem I'm having is if someone tries an url like this: websiteurl.com/directory/file It will display the content for the default (in this case home, since that's what I set it to at the start) in the directory. This means there is no styling and I run into a whole load of problems after that. So, that's my problem. Does anyone know how I would solve this? I'm unsure if it's because of the .HTACCESS or the way the PHP is being used. I'd also like to know if there are any other security flaws with this code? I'm also sorry if I've been unclear or if my sentences don't make sense (it's rather later and I'm not sleeping lately) And lastly, I'm sorry if I've broken any forum rules, since this is my first post I'm a little weary. Thanks a lot guys. Pete. Hi All,
Am hoping someone can point out my perhaps obvious issue here.
I've a series of links that are dynamically created:
<a class="team-link" rel="<?php the_ID(); ?>" href="#">When a link is clicked, I'm trying to get content to load into this DIV: <div id="single-post-container"></div>I have the following jquery: <script> $(document).ready(function(){ $.ajaxSetup({cache:false}); $(".team-link").click(function(){ var post_id = $(this).attr("rel"); $.ajax({ url : "http://www.domain.co.uk/wp-content/themes/name/loop.php", data : {"the_team": post_id }, type : "POST", dataType : "html", success: function(response) { $("#single-post-container").html(response); } return false; }); }); </script>This is my loop.php file: require_once('../../../wp-load.php'); // Our variables $the_team = (isset($_GET['post_id'])) ? $_GET['post_id'] : 0; echo $the_team; query_posts(array( 'post_type' => 'work', 'meta_key' => 'author_name', 'meta_value' => $the_team )); // our loop if (have_posts()) { while (have_posts()){ the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_content(); ?> <hr /> <?php } } wp_reset_query();However, when you click the link, nothing happens. I know loop.php works as I can specify a value and manually browse to it to see the content. I feel I'm missing something obvious as I'm new to AJAX. Your help/patience is very much appreciated This might be a very easy problem to solve. I am literally brand new to php. I am trying to create a simple site that will load content depending on what page 'id' is in the URL and if it doesn't exist to show a page for that scenario. eg index.php?id=1 will show the page 1.php It works fine apart from showing an error when there is no id at all, eg www.website.com will show an error but www.website.com/index.php?id=1 will show a page I want to be able to show the homepage if there is no 'id' at all. Code: [Select] <?php $id = $_GET['id']; if(file_exists("./".$id.".php")) { include ("./".$id.".php"); } else { include ("404.php"); } ?> Any help is appreciated Thanks Hi all, I'm not sure if this is a PHP question or javascript, so if it needs to be moved can an admin please do so... Anyway, basically I have the following code: Code: [Select] <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">View Availability</a> This pops up a divs with a black alpha background, so that it appears the new content is displaying over the top of the current content. This all works fine, however the content I am displaying in the top level div is (or should be) dynamic. In order for the content to be useful I need to grab the id. Normally I would simply do this: Code: [Select] <a href = "[b]url.php?uniqueidentifier=<?php echo $row['id'];?>[/b]" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">View Availability</a> However what happens in this instance is that the page loads with the javascript and the id in the url but it then disappears... Has anyone got any ideas on how I might be able to get around this? Many thanks, Greens85 Working on a site with a couple hundred virtually identical landing pages to maximize SEO. Rather than hard code the pages, I am wondering if there is a way to have one page that handles all the url's and dynamically codes and loads with title, keywords, content & alt tags all specific to the particular url requested. Seems like the challenge is doing it in a way that does not constitute a redirect. Is it better to do this in the .htaccess? Hi there, I know that php does not recognize onMouseOver events. however, Im wondering if their is a tricky way to get a javascript response from dynamic text. I am working on a nav menu in a wordpress site. wordpress has a function that displays a list of pages created in the admin. I want to be able to display a secondary list of pages when a top-level nav item is moused over. heres the code: <div id="top"> <script type="text/javascript"> function Show(who) { Clear(); divel=document.getElementById("drop"+who); divel.style.display="inline"; divel=document.getElementById("hn"+who); divel.className="selected"; } function Hide(who) { divel=document.getElementById("drop"+who); divel.style.display="none"; divel=document.getElementById("hn"+who); divel.className=""; } function Clear() { for (i=1;i<=3;i++) { divel=document.getElementById("drop"+i); divel.style.display="none"; divel=document.getElementById("hn"+i); divel.className=""; } } </script> <div id="home-nav" onMouseOut="Clear();"> <ul> <li id="hn1"><a href="wp_demo/profile" onMouseOver="Show('1')"><?php wp_list_pages(include=4&title_li=' ); ?></a></li> <li id="hn2"><a href="wp_demo/services" onMouseOver="Show('2')"><?php wp_list_pages( 'include=6&title_li=' ); ?></a></li> <li id="hn3"><a href="wp_demo/portfolio" onMouseOver="Show('3')"><?php wp_list_pages( 'include=8&title_li=' ); ?></a></li> <li id="hn4"><a href="wp_demo/contact" onMouseOver="Clear();"><?php wp_list_pages( 'include=12&title_li=' ); ?></a></li> <li id="hn5"><a href="wp_demo/hospitality" onMouseOver="Clear();"><?php wp_list_pages( 'include=10&title_li=' ); ?></a></li> </ul> </div> <!-- #homenav --> <div id="wrapper"> <div id="drop1" onMouseOver="Show('1')" onMouseOut="Hide('1')"> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/blank.gif" alt="" width="960" height="8" border="0" /><br /> <div id="menu1"><ul> <?php wp_list_pages( 'child_of=4&sort_column=menu_order&title_li=' ); ?> </ul></div></div> <div id="drop2" onMouseOver="Show('2')" onMouseOut="Hide('2')"> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/blank.gif" alt="" width="960" height="8" border="0" /><br /> <div id="menu2"><ul> <?php wp_list_pages( 'child_of=6&sort_column=menu_order&title_li=' ); ?> </ul></div></div> <div id="drop3" onMouseOver="Show('3')" onMouseOut="Hide('3')"> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/blank.gif" alt="" width="960" height="8" border="0" /><br /> <div id="menu3"><ul> <?php wp_list_pages( 'child_of=8&sort_column=menu_order&title_li=' ); ?> </ul></div></div> Does anybody know a trick to get the dynamic text to be seen by the javascript? for example, if i put a inside the anchor tags before the php script starts, the onmouseover will register it, and display the secondary nav. I would place invisible divs with links on top of the dynamic text with z-index, but I want the text to be completely dynamic and the client to be able to add as many links as he/she wants. thanks! This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357949.0 I got a question regarding a news website content that i want to make ! my question is how do i call my contents without using a lot of page? i explain let's say i got 10 news how do i put this 10 news in different pages without using 10 pages ? ex: you can see some links having a number like this http://bbc.uk/news/murder_case-12 then the next page got http://bbc.uk/news/finance-13 the title and the number id change but the page news doesnt change thanks for your answer. Hi, I have an image map mixed in with php, and it won't click when I click the mouse on it, it won't work. Any help greatly appreciated. Thanks. Derek here is the code where I use it. Code: [Select] if(isset($_GET['newLocation'])) { $_SESSION['current_location']=$_GET['newLocation']; } if(!isset($_SESSION['current_location']) && !isset($_SESSION['current_background']) && !isset($_SESSION['currentMonster'])) { $_SESSION['current_location'] = 0; $_SESSION['current_monster'] = 0; $_SESSION['current_background'] = 0; } if($_SESSION['current_location'] != 0) { if(!isset($_SESSION['current_background']) && !isset($_SESSION['current_monster'])) { $_SESSION['current_monster'] = 0; $_SESSION['current_background'] = 0; } if(isset($_GET['further'])) { //below is- inside the locations array, teardrop ocean (1) the background image is 4(example)+1 is set, then //do this if(isset($locations[$_SESSION['current_location']]['background_images'][$_SESSION['current_background']+1])) { $_SESSION['current_background']+=1; } if(isset($locations[$_SESSION['current_location']]['monster_images'][$_SESSION['current_monster']+1])) { $_SESSION['current_monster']+=1; } } elseif(isset($_GET['back'])) { if(isset($locations[$_SESSION['current_location']]['background_images'][$_SESSION['current_background']-1])) { $_SESSION['current_background']-=1; } if(isset($locations[$_SESSION['current_location']]['monster_images'][$_SESSION['current_monster']-1])) { $_SESSION['current_monster']-=1; } } // I dont have any $_SESSION['background'] var //$currentBackground=$_SESSION['background'][$_SESSION['current_background']]; $currentBackground = $locations[$_SESSION['current_location']]['background_images'][$_SESSION['current_background']]; //I dont have any $_SESSION['monster'] var //$currentMonster=$_SESSION['monster'][$_SESSION['current_monster']]; $currentMonster=$locations[$_SESSION['current_location']]['monster_images'][$_SESSION['current_monster']]; } else { //?newLocation=1 means set it to Teardrop ocean. $currentBackground = ' <img src="aradia.jpg" width="256" height="328" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="5,176,81,249" href="?newLocation=1"/> </map>'; $currentMonster = ''; } I am trying to have an UPDATE query run when I click an image on a web page. I just need to have the image call the function to run the mysql from the corresponding php file. The image is a form object, which I need the php function to recognize when it is clicked, and then run the query(ies) within. I don't really know much php, so the php code is based on a snippet I have from one of my other sites, which works fine over there, but I am missing something here that is keeping it from doing the same here. The page already loads and displays all values in a list associated with $show_id, so that variable is already being pulled from the web page in to the php code. I'm not going to paste the entire books.php file here as there are too many things it does which doesnt have anything to do with this little add-on I am making. I just need to be able to pull that variable in to the query below and have it run when I click on the icon associated with it. The php file also already has the proper config and settings files linked to it that connect to the database, so I do not need to set that up here. It is just a form, calling a function, and running the query. It is also not visible to the user side. It is in an admin page, only visible and accessible to me. This is code I have in the php file: function UpdateAllShowBooks() { if(strlen(($_POST['retired'])) > 0){ $sql = "UPDATE ttb_books SET status_id = '2' WHERE show_id='$show_id'"; $db = new database(); $db->myquery($sql, 1); header('Location:books.php?show_id=$show_id'); die(); } if(strlen(($_POST['upcoming'])) > 0){ $sql = "UPDATE ttb_books SET status_id = '37' WHERE show_id='$show_id'"; $db = new database(); $db->myquery($sql, 1); header('Location:books.php?show_id=$show_id'); die(); } if(strlen(($_POST['current'])) > 0){ $sql = "UPDATE ttb_books SET status_id = '1' WHERE show_id='$show_id'"; $db = new database(); $db->myquery($sql, 1); header('Location:books.php?show_id=$show_id'); die(); } } This is the current image/form html: <center><table width=25%> <tr><td valign="top" align="center"> <!--<form method="post" action="books.php?show_id={show_id}">--> <form method="post" action="books.php" name="retired"> <input type="image" src="../images/icon-Red_Light.png" width="20" name="retired" alt="Set status to Out of Print" title="Set status to Out of Print" onclick="return confirm('Set ALL status to Out of Print?')"> <input name="shid1" type="hidden" id="shid1" value="{show_id}" /> </form> </td><td valign="top" align="center"> <form method="post" action="books.php" name="upcoming"> <input type="image" src="../images/icon-Yellow_Light.png" width="20" name="upcoming" alt="Set status to Upcoming Release" title="Set status to Upcoming Release" onclick="return confirm('Set ALL status to Upcoming Release?')"> <input name="shid2" type="hidden" id="shid2" value="{show_id}" /> </form> </td><td valign="top" align="center"> <form method="post" action="books.php" name="current"> <input type="image" src="../images/icon-Green_Light.png" width="20" name="current" alt="Set status to In Print" title="Set status to In Print" onclick="return confirm('Set ALL status to In Print?')"> <input name="shid3" type="hidden" id="shid3" value="{show_id}" /> </form> </td></tr> </table></center> So clicking on the form image would call the function with that mysql string and update all items in the list accordingly. At this time, when I click the image, it reloads the page fine, but it is not activating the sql in the function and making the Update occur. Thank you for any help you can provide. I really appreciate it. Hi , I have one question .. Can I split showing of content of dynamic list in 2 parts , when I echo list in code .. Code: [Select] <?php // Run a select query to get my letest 8 items // Connect to the MySQL database include "../connect_to_mysql.php"; $dynamicList = ""; $sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 8"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList .= '<table width="100%" border="2" cellspacing="2" cellpadding="2"> <tr> <td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="2" /></a></td> <td width="83%" valign="top">' . $product_name . '<br /> $' . $price . '<br /> <a href="product.php?id=' . $id . '">View Product Details</a></td> </tr> </table>'; } } else { $dynamicList = "We have no products listed in our store yet"; } mysql_close(); ?> Code: [Select] <p><?php echo $dynamicList; ?><br /> </p> It works ok, and putting my files, everything works, but when I put 8 pictures with price and other details, it just show one image with details and another image below with details, and the third image below and so on .. Can I split dynamic list to show 4 images with details on the left side and 4 on the right side? Thank you in advance for help , if is possible Hi, I need to run a database insert when somebody clicks on an image. Should I use a php function ? or javascript ? or something else ? Many thanks in advance, Scott. Hey guys, I want to pass the unique id of a node to a function when that image is clicked. Actually i am a newbee in php so don't know what to search about or where to look for it,but find this place and you all guys so helpful so i am asking for a guide here |