Jump to content

sam123

Members
  • Posts

    44
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

sam123's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Your code works great. Thank you so much mac_gyver. With your help I have got a better approach for the code. Thanks a lot.
  2. Modified code is here. Please let me know if you can suggest anything else on modifiying the code. //Send mail two days prior to deadline if ($diff == "-2") || ($diff == "-1") { //Selecting emails $dquery = "select * from users where uid ='$aid'"; // echo"<br>dquery=$dquery<br>"; $dresult = mysql_query($dquery) or die("".mysql_errno()." Error: ".mysql_error()); if(mysql_num_rows($dresult) > 0) { $recipients = array(); while($row = mysql_fetch_array($dresult)) { $recipients[] = $row['email']; // echo '<span style="color:#FF7600">',$row['email'], '</span>'; } } //Sending message $subject = "Job $id is due on $ddate"; $message .= "<html><body><table width=500 border=1px solid #ccc align=center cellpadding=0 cellspacing=0 bgcolor=#E8E8E8>"; $message .="<tr><th colspan=2 align=center bgcolor=#4D4D4D height=26><b>"; $message .= "Job Details</b> </th></tr>"; $message .= "<tr><th width=120 align=left>Id:</th><th width=280 align=left>$id</th></tr>"; $message .= "<tr><th width=120 align=left>Created By: </th><th width=280 align=left> $owner</th></tr>"; $message .= "<tr><th width=120 align=left>Deadline:</th><th width=280 align=left> $ddate</th></tr>"; $message .= "</table>"; $message .= "</body></html>"; $adminemail = "admin@website.com"; $headers .= "From:{$adminemail}". "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; foreach ($recipients as $to) { $success = mail($to,$subject,$message,$headers); } if ($success) { echo "Due Reminder send successfully to the following recipients.<br>"; echo "Name:$aname - Id:$id <br>"; } else { echo "Something wrong happend.Please try again."; } }//end if //Send mail if the job is overdue if ($diff > "0") { //Selecting emails $dquery = "select * from users where uid ='$aid'"; // echo"<br>dquery=$dquery<br>"; $dresult = mysql_query($dquery) or die("".mysql_errno()." Error: ".mysql_error()); if(mysql_num_rows($dresult) > 0) { $recipients = array(); while($row = mysql_fetch_array($dresult)) { $recipients[] = $row['email']; //echo '<span style="color:#FF7600">',$row['email'], '</span>'; } } //Sending message $subject = "Job $id is Overdue by $diff"; $message .= "<html><body><table width=500 border=1px solid #ccc align=center cellpadding=0 cellspacing=0 bgcolor=#E8E8E8>"; $message .="<tr><th colspan=2 align=center bgcolor=#4D4D4D height=26><b>"; $message .= "Job Details</b></th></tr>"; $message .= "<tr><th width=120 align=left>Id:</th><th width=280 align=left> $id</th></tr>"; $message .= "<tr><th width=120 align=left>Created By: </th><th width=280 align=left> $owner</th></tr>"; $message .= "<tr><th width=120 align=left>Deadline:</th><th width=280 align=left> $ddate</th></tr>"; $message .= "</table>"; $message .= "</body></html>"; $from = "admin@website.com"; $adminemail = "admin@website.com"; $headers .= "From:{$adminemail}". "\r\n"; $headers .= "Cc: $remail\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; foreach ($recipients as $to) { $success = mail($to,$subject,$message,$headers); } if ($success) { echo "Job Over Due Reminder send successfully to the following recipients.<br>"; echo "Name:$aname - Id:$id <br>"; } else { echo "Something wrong happend.Please try again."; } }//end if } // end reminder
  3. Thank you somuch for your valuable reply mac_gyver. I have modified the code according to your suggestion, but still having the problem. In user table i am saving all the user details and job table i am saving all the job details. Here is the example. id---------Job -------------rname-----------remail-----------------------deadline-------status-------aname----aid-----createdby 1 -----Test Job1----------Sam--------sam@test.com----------2013-06-20------Open---------sara------12--------Sam 2 -----Test Job2---------David-------david@test.com---------2013-06-18------Open---------Jim-------10--------David 3 -----Test Job3---------Don---------don@test.com-----------2013-06-19------Open---------Kale------8----------Don rname-requestername and aname-assignee name. I am not saving assignees email id in the job table,it is stored in the user table and i am getting the assignees email using aid $dquery = "select * from users where uid ='$aid'. But the poblem what i am facing is that if the job is over due, as i told you earlier, i need to send that to supervisor also. That email(remail) i am getting from the job table directly since i saved it while creating the job. So it will be on the first loop while ($raw = mysql_fetch_array($scheduleResult)) { $remail = $raw['remail']; } so it is taking all the $remail values for the cc feild. In the above example, 2 jobs crossed the deadline. While sending email to the assignee, it will send cc mails to both requesters david@test.com and don@test.com. But i want to testjob2's cc email need to send only david@test.com and testjob3's cc mail need to send only to don@test .com. Now the the correct email is sending to the assignee with the corresponding job details.This part is working perfectly alright.. Sorry for the lengthy reply, i was working on this for this last couple of days ,but in vain..I know iam doing something wrong here, but i could not figure it out. Thank you.
  4. Is there any suggestion/solution for solving the cc field issue? Thanks in Advance.
  5. Hi All, I have been working on an application where I need to send reminder mails to my users when the condition is met. I will send the reminder mail only to the users 2 days prior to the deadline. Once they crossed the deadline i need to send mail to users along with his supervisor(cc). My code is working perfectly on sending reminder mails to the users but cc to the supervisor part is not working. I have stored all the details to the same table while creating the job. $remail is the field where i am saving the supervisor email.Now the problem is that once the job is overdue its taking all the emails from the $remail instead of taking the jobs corresponding $remail. Can any one help me on this? Anyone have suggestions on a better way of getting this done? <?php //Send mail after checking the date difference $viewSchedule = "select * from job WHERE status = 'Open'"; $scheduleResult = mysql_query($viewSchedule,$link) or trigger_error("SQL", E_USER_ERROR); while ($raw = mysql_fetch_array($scheduleResult)) { $id=$raw['id']; $aid = $raw['aid']; $aname = $raw['aname']; $remail = $raw['remail']; $owner = $raw['owner']; $reminder = $raw['reminder']; $status=$raw['status']; $deadline = $raw['deadline']; $todaysdate = date("Y-m-d"); $date_diff=strtotime($todaysdate) - strtotime($deadline); $diff=($date_diff/(60 * 60 * 24)); $ddate = date('d-m-Y', strtotime($deadline)); //Cheking date difference //Send mail two days prior to deadline if ($diff == "-2") { //Selecting emails $dquery = "select * from users where uid ='$aid'"; // echo"<br>dquery=$dquery<br>"; $dresult = mysql_query($dquery) or die("".mysql_errno()." Error: ".mysql_error()); if(mysql_num_rows($dresult) > 0) { $recipients = array(); while($row = mysql_fetch_array($dresult)) { $recipients[] = $row['email']; // echo '<span style="color:#FF7600">',$row['email'], '</span>'; } } //Sending message $subject = "Job $id is due on $ddate"; $message .= "<html><body><table width=500 border=1px solid #ccc align=center cellpadding=0 cellspacing=0 bgcolor=#E8E8E8>"; $message .="<tr><th colspan=2 align=center bgcolor=#4D4D4D height=26><b>"; $message .= "Job Details</b> </th></tr>"; $message .= "<tr><th width=120 align=left>Id:</th><th width=280 align=left>$id</th></tr>"; $message .= "<tr><th width=120 align=left>Created By: </th><th width=280 align=left> $owner</th></tr>"; $message .= "<tr><th width=120 align=left>Deadline:</th><th width=280 align=left> $ddate</th></tr>"; $message .= "</table>"; $message .= "</body></html>"; $adminemail = "admin@website.com"; $headers .= "From:{$adminemail}". "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; foreach ($recipients as $to) { $success = mail($to,$subject,$message,$headers); } if ($success) { echo "Due Reminder (2 day Prior) send successfully to the following recipients.<br>"; echo "Name:$aname - Id:$id <br>"; } else { echo "Something wrong happend.Please try again."; } }//end if //Send mail one day prior to deadline if ($diff == "-1") { //Selecting emails $dquery = "select * from users where uid ='$aid'"; // echo"<br>dquery=$dquery<br>"; $dresult = mysql_query($dquery) or die("".mysql_errno()." Error: ".mysql_error()); if(mysql_num_rows($dresult) > 0) { $recipients = array(); while($row = mysql_fetch_array($dresult)) { $recipients[] = $row['email']; // echo '<span style="color:#FF7600">',$row['email'], '</span>'; } } //Sending message $subject = "Job $id is due on $ddate"; $message .= "<html><body><table width=500 border=1px solid #ccc align=center cellpadding=0 cellspacing=0 bgcolor=#E8E8E8>"; $message .="<tr><th colspan=2 align=center bgcolor=#4D4D4D height=26><font color=#FFFFFF face=Arial, Helvetica, sans-serif><b>"; $message .= "Job Details</b></th></tr>"; $message .= "<tr><th width=120 align=left>Id:</th><th width=280 align=left> $id</th></tr>"; $message .= "<tr><th width=120 align=left>Created By: </th><th width=280 align=left> $owner</th></tr>"; $message .= "<tr><th width=120 align=left>Deadline:</th><th width=280 align=left> $ddate</th></tr>"; $message .= "</table>"; $message .= "</body></html>"; $adminemail = "admin@website.com"; $headers .= "From:{$adminemail}". "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; foreach ($recipients as $to) { $success = mail($to,$subject,$message,$headers); } if ($success) { echo "Job Due Reminder (1 day Prior) send successfully to the following recipients.<br>"; echo "Name:$aname - Id:$id <br>"; } else { echo "Something wrong happend.Please try again."; } }//end if //Send mail if the job is overdue if ($diff > "1") { //Selecting emails $dquery = "select * from users where uid ='$aid'"; // echo"<br>dquery=$dquery<br>"; $dresult = mysql_query($dquery) or die("".mysql_errno()." Error: ".mysql_error()); if(mysql_num_rows($dresult) > 0) { $recipients = array(); while($row = mysql_fetch_array($dresult)) { $recipients[] = $row['email']; //echo '<span style="color:#FF7600">',$row['email'], '</span>'; } } //Sending message $subject = "Job $id is Overdue by $diff"; $message .= "<html><body><table width=500 border=1px solid #ccc align=center cellpadding=0 cellspacing=0 bgcolor=#E8E8E8>"; $message .="<tr><th colspan=2 align=center bgcolor=#4D4D4D height=26><b>"; $message .= "Job Details</b></th></tr>"; $message .= "<tr><th width=120 align=left>Id:</th><th width=280 align=left> $id</th></tr>"; $message .= "<tr><th width=120 align=left>Created By: </th><th width=280 align=left> $owner</th></tr>"; $message .= "<tr><th width=120 align=left>Deadline:</th><th width=280 align=left> $ddate</th></tr>"; $message .= "</table>"; $message .= "</body></html>"; $from = "admin@website.com"; $adminemail = "admin@website.com"; $headers .= "From:{$adminemail}". "\r\n"; $headers .= "Cc: $remail\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; foreach ($recipients as $to) { $success = mail($to,$subject,$message,$headers); } if ($success) { echo "Job Over Due Reminder send successfully to the following recipients.<br>"; echo "Name:$aname - Id:$id <br>"; } else { echo "Something wrong happend.Please try again."; } }//end if } // end reminder ?>
  6. Thanks for your help PFMaBiSmAd. Working perfectly now. Thanks again.
  7. Hi PFMaBiSmAd, This the query i am using . $query="SELECT gc.category_id, gc.category_name, p.photo_id, p.photo_caption, p.photo_filename FROM gallery_category AS gc INNERJOIN photos AS p ON p.category_id = gc.category_id ORDERBY gc.category_id ASC , p.photo_id DESC"; and while running this query in phpmyadmin i am getting the following output. category_id ---/--- category_name ---/--- photo_id ---/--- photo_caption ---/--- photo_filename -------1----------/---- Test1------------/---- 54---------/---- test1-----------/--- 54.jpg --------1----------/---- Test2------------/----53---------/---- test2-----------/--- 53.jpg --------1----------/---- Test3------------/---- 52---------/---- test3-----------/--- 52.jpg --------1----------/---- Test4------------/---- 51---------/---- test4-----------/--- 51.jpg --------2----------/---- Test5------------/---- 55---------/---- test5-----------/--- 55.jpg----- Here is the html page code. <?php $title = "Photogallery"; include "header.php"; include "config.php"; //$catid = (int)($_GET['catid']); //$pid = (int)($_GET['pid']); // Category Listing //$number_of_categories_in_row = 4; ?> <div id="breadcrumbs"><a href="index.php">Home</a> / <span>Photogallery</span></div> <div class="left_side"> <h2>Photogallery</h2> <div class="left_side_content"> <!--p>Coming Soon...</p--> <!-- the tabs --> <?php $tab_content = ''; $gallery_content = ''; $last_gallery = null; $query = "SELECT gc.category_id, gc.category_name, p.photo_id, p.photo_caption, p.photo_filename FROM gallery_category AS gc INNER JOIN photos AS p ON p.category_id = gc.category_id ORDER BY gc.category_id ASC , p.photo_id DESC"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) {// category/tab values $catid = $row['category_id']; $category_name = $row['category_name']; // gallery values $photo_caption = $row['photo_caption']; $photo_filename = $row['photo_filename']; // build tab content if($last_gallery != $catid) { $tab_content .= "<li><a href='#' rel='view{$catid}'>$category_name</a></li>"; $last_gallery = $catid; } // build gallery content $gallery_content .= "<div id='view{$catid}' class='tabcontent'>"; $gallery_content .= "$photo_caption</br>"; $gallery_content .= "<img src='{$images_dir}/tb_{$photo_filename}' border='0'>"; $gallery_content .= "</div>"; } // output the HTML document - ?> <ul class="tabs"><?php echo $tab_content; ?></ul> <div class="tabcontents"><?php echo $gallery_content; ?></div> <!-- tab ends --> </div> </div> <?php include "sidebar.php"; ?> </div> <?php include "footer.php"; ?> Since i am still working on this, i am using this test data only. Thanks, Sam.
  8. Thanks Christian. I changed int(20) to int(11). Also i changed the query as follows $query = "SELECT gc.category_id, gc.category_name, p.photo_id, p.photo_caption, p.photo_filename FROM gallery_category AS gc INNER JOIN photos AS p ON p.category_id = gc.category_id ORDER BY gc.category_id ASC , p.photo_id DESC"; But still getting the wrong display result. Is there any simple way i can do it..?
  9. Hi PFMaBiSmAd, I didnot change anything on your code. Just copied and posted on my php page.The html output i checked and i also got the way as yours. But not getting the expected result. Is it due to my tabbed content script error..? Thanks, Sara.
  10. Hi Christian, I wanted to make one-to-many relationship between the categories and pictures, so i altered my tables as follows. ALTER TABLE photos ADD FOREIGN KEY (category_id) REFERENCES gallery_category(category_id) Now the table structure is like this. CREATE TABLE IF NOT EXISTS `gallery_category` ( `category_id` int(11) NOT NULL auto_increment, `category_name` text NOT NULL, PRIMARY KEY (`category_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE IF NOT EXISTS `photos` ( `photo_id` int(20) NOT NULL auto_increment, `photo_filename` varchar(25) NOT NULL, `photo_caption` text NOT NULL, `category_id` int(20) NOT NULL, PRIMARY KEY (`photo_id`), KEY `category_id` (`category_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=56 ; so now category_ID is AUTO_INCREMENT and PRIMARY KEY in gallery_category table and category ID is the FOREIGN KEY in photo table. Please check it and let me know this is correct.. Thanks, Sam.
  11. In the HTML output the tabs is displaying correctly as tabs1->Test1(category1) and tab2->Test2(category2). But the problem is with the content of each category.(please check the screenshot which i have added in my last reply) Test1(category1) should display the content photo_caption test1,test2,test3,test4 with images 1.jpg,2.jpg,3.jpg,4.jpg and Test2(category2) should display the content photo_caption test5 with images 5.jpg (please check the database result after running the query which i have added earlier.) But now what i am getting is that, Test1(category1) displays the result as the content photo_caption test1,test2,test3,test4 with images 1.jpg,2.jpg,3.jpg,4.jpg and Test2(category2) displays the result as the content photo_caption 1.jpg,2.jpg,3.jpg,test5 with images test1,test2,test3,5.jpg. Here in Test2(category2) it should display the the content photo_caption test5 with images 5.jpg only. I have not yet set the correct $images_dir variable since i am still working on the code to get it working. Thanks for your help and time. Sam.
  12. I tried the edited code and i am getting the result like this.Please see the attachment. Tab is showing correct category, but corresponding category content is not displaying.
  13. Thank you both of you for helping me in this problem. But still its not working as expected. $query = "single query that gets the joined information you want in the order that you want it"; Here i used the query " SELECT gc.category_id, gc.category_name, p.photo_id, p.photo_caption, p.photo_filename FROM gallery_category AS gc INNER JOIN photos AS p ON p.photo_category = gc.category_id ORDER BY gc.category_id ASC , p.photo_id DESC " as Christian suggested and i got the following result. category_id ---/--- category_name ---/--- photo_id ---/--- photo_caption ---/--- photo_filename ---1----------/---- Test1------------/---- 1---------/---- test1-----------/--- 1.jpg----- ---1----------/---- Test2------------/---- 2---------/---- test2-----------/--- 2.jpg----- ---1----------/---- Test3------------/---- 3---------/---- test3-----------/--- 3.jpg----- ---1----------/---- Test4------------/---- 4---------/---- test4-----------/--- 4.jpg----- ---2----------/---- Test5------------/---- 5---------/---- test5-----------/--- 5.jpg----- But the tabs are not working as expected.I have attached the results which i got it after running the query. Thanks for your time. Sam.
  14. I didnot clear this part to make a join. Sorry i am not that much good in writting sql queries. I have added a javascript part also with the code which i got it from the same script site. var tabs=function(){var c=function(c,a){var b=new RegExp("(^| )"+a+"( |$)");return b.test(c.className)?true:false},j=function(a,B){if(!c(a,B))if(a.className=="")a.className=b;else a.className+=" "+b},h=function(a,B){var c=new RegExp("(^| )"+b+"( |$)");a.className=a.className.replace(c,"$1");a.className=a.className.replace(/ $/,"")},g=function(c,B){var a=document.getElementsByTagName("html");if(a)a[0].scrollTop+=b},e=function(){var a=window.location.pathname;if(a.indexOf("/")!=-1)a=a.split("/");var b=a[a.length-1]||"root";if(b>20)b=b.substring(b.length-19);return b},a=e(),d=function(a){this.a=0;this.b=[];this.c=[];this.d=[];this.e=0;this.f(a)}.prototype={g:function(c){var d=new RegExp(a+c+"=[^;&]+"),b=document.cookie.match(d);return b?b[0].split("=")[1]:this.h()},h:function(){for(var a=0,b=this.d.length;a<b;a++)if(c(this.d[a],"selected"))return a;return 0},j:function(d,c){for(var b=d.getAttribute("rel"),a=0;a<this.b.length;a++)if(this.b[a].getAttribute("rel")==B){j(this.b[a].parentNode,"selected");c&&this.e&&this.k(this.a,a)}else h(this.b[a].parentNode,"selected");this.l(B)},k:function(b,c){if(document.cookie.indexOf("tabContent=")==-1)document.cookie="tabContent="+a+b+"="+c+";path=/";else if(document.cookie.indexOf(a+B)==-1){var e=new RegExp("tabContent=[^;]+");document.cookie=document.cookie.match(e)[0]+"&"+a+b+"="+c+";path=/"}else{var e=new RegExp(a+b+"=\\d+","g"),d=document.cookie.replace(e,a+b+"="+c);document.cookie=d.substring(d.indexOf("tabContent="))}},l:function(B){for(var a=0;a<this.c.length;a++)this.c[a].style.display=this.c[a].id==b?"block":"none"},m:function(a){if(a.id)for(var b=0;b<this.b.length;b++)if(this.b[b].getAttribute("rel")==a.id)return this.b[b];return a.parentNode.nodeName!="BODY"?this.m(a.parentNode):null},n:function(d,c){var a=document.getElementById(d);if(a){var b=this.m(a);if(B){this.j(b,0);if(!c)setTimeout(function(){a.scrollIntoView();g(a,-120)},0);else setTimeout(function(){window.scrollTo(0,0)},0);return 1}else return 0}},f:function(a){this.a=a.i;this.b=a.getElementsByTagName("a");this.d=a.getElementsByTagName("li");for(var b=0;b<this.b.length;b++)if(this.b[b].getAttribute("rel")){this.c.push(document.getElementById(this.b[b].getAttribute("rel")));var f=this;this.b[b].onclick=function(){f.j(this,1);return false}}var e=a.getAttribute("persist")||"";this.e=e.toLowerCase()=="true"?1:0;var d=window.location.hash;if(d&&d.length>1)if(this.n(d.substring(1),window.location.search.indexOf("noscroll=true")>-1))return;var c=this.e?parseInt(this.g(a.i)):this.h();if(c>=this.b.length)c=0;this.j(this.b[c],0)}};var b=[],i=function(d){var b=false;function a(){if(b)return;b=true;setTimeout(d,4)}if(document.addEventListener)document.addEventListener("DOMContentLoaded",a,false);else if(document.attachEvent){try{var e=window.frameElement!=null}catch(f){}if(document.documentElement.doScroll&&!e){function c(){if(b)return;try{document.documentElement.doScroll("left");a()}catch(d){setTimeout(c,10)}}c()}document.attachEvent("onreadystatechange",function(){document.readyState==="complete"&&a()})}if(window.addEventListener)window.addEventListener("load",a,false);else window.attachEvent&&window.attachEvent("onload",a)},f=function(){for(var e=document.getElementsByTagName("ul"),a=0,f=e.length;a<f;a++)if(c(e[a],"tabs")){e[a].i=b.length;b.push(new d(e[a]))}};i(f);return{open:function(c,d){for(var a=0;a<b.length;a++)b[a].n(c,d)}}}() What i am trying to acheive is that if i click a tab its content should display there. But in my case its not displaying. If i click the tab1, its content is showing. But if i click on the second tab the content is not showing. Also if I click a link under a tab, page refreshes and all ok, then move to another tab and click a link under that tab(tab2) and on the page refresh the tab goes back to the first tab(tab1). Thats the problem i am facing now. Its not showing any errors, but i am getting tabs with out any content.I am thinking something wrong in getting the value of catid or the value is not moving to the second tab. Please let me know if you need any more clarification of the problem. Is there any simple way i can display the image gallery pictures in a tabbed view? Thanks, Sam.
  15. Hi PFMaBiSmAd, Thanks for your reply. Sorry for the errors in my posting. I was trying to make this work from last one week and many versions i tried. But still it is not working. I am trying to make a tabbed gallery. I got this tabbed page script from the net. It actually works like this. <ul class="tabs"> <li><a href="#" rel="view1">tab1</a></li> <li><a href="#" rel="view2">tab2</a></li> </ul> <div class="tabcontents"> <div id="view1" class="tabcontent"> tab1 content goes here. </div> <div id="view2" class="tabcontent"> tab2 content goes here. </div> </div> There is no javacript to get the value of tabs. I have modified the above code to make my gallery works. <ul class="tabs"> <?php $sql = "SELECT * FROM gallery_category ORDER BY category_id ASC"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $cid = $row['category_id']; $category_name = $row['category_name']; echo "<li><a href='?catid=".$cid."' rel='view".$cid."'>$category_name</a></li> "; } echo "</ul>"; ?> The above part is working fine. May be i am doing wrong here. <div class="tabcontents"> <?php //$catid = (int)($_GET['catid']); $sql = "SELECT * FROM gallery_category ORDER BY category_id ASC"; $query = mysql_query($sql); $catarray = array(); while($row = mysql_fetch_array($query)) { $catarray[] = $row['category_id']; // $catid = $row['category_id']; foreach($catarray as $catid){ echo"<div id='view".$catid."' class='tabcontent'>"; $catid = (int)($_GET['catid']); $sql = "SELECT * FROM photos WHERE photo_category = $catid ORDER BY photo_id DESC"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $pid = $row['photo_id']; $photo_caption = $row['photo_caption']; $photo_filename = $row['photo_filename']; echo "$photo_caption</br>"; echo "<img src='".$images_dir."/tb_".$row[photo_filename]."' border='0'"; } echo "</div>"; } } ?> </div> Can you please help me to solve my problem here. I am really confused how to do that..and i am wasting lot of time also without any success. Any help will be greatly appreciated. Thanks, Sam.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.