Jump to content

proctk

Members
  • Posts

    300
  • Joined

  • Last visited

    Never

Everything posted by proctk

  1. The problem is the date value in the mysql tabel. I need to somehow use mysql to change the date from 1978-03-11 to 2008-03-11. any ideas how to change the year
  2. HI I have then below that is supposed to return a reformated date from a field in a mysql date field in my table. users.spousedob = 1978-03-11 DATE_FORMAT(users.spousedob, '%a %b %e') The is returning Saturday, March 11 2008 but should be returning Tuesday, March 11 2008 Any ideas how to fix this Thank you
  3. here is the complete code for the page <?php /* Check User Script */ session_start(); // Start Session include ("../Connections/db.php"); //check if user is already logged in if (!isset($_SESSION['user_id'])){ $msg = 'You tryed to access a members only page. Login or become a registered member to access that page!'; header("Location: ../index.php?msg=".$msg); } //Checks if the profile request is for a new login or someone requesting if(isset($_GET['id'])){ $id = $_GET['id']; }else{ $id = $_SESSION['user_id']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/twoCoumn.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Family Click|Album Photos</title> <!-- InstanceEndEditable --> <link rel="stylesheet" href="../design/tabbler.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../design/tabbler-print.css" type="text/css" media="print" /> <link rel="stylesheet" type="text/css" href="../design/layout.css" /> <link rel="stylesheet" type="text/css" href="../design/design.css" /> <script type="text/javascript" src="../design/tabber.js"></script> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> </head> <body> <div id="outer"> <div id="hdr"> <div id="logo-div"> <h2 id="logo"><a href="../index.php">Family Click</a></h2> <h4 id="slogan-text">Keeping Families Connected</h4> </div> <div class="headerText"> <h5> </h5> </div> </div> <div style="clear:left"></div> <div id="bar"><!-- InstanceBeginEditable name="Bar" --><?php include('../design/bar.php'); ?><!-- InstanceEndEditable --></div> <div id="bodyblock" align="right"> <div id="l-col" align="left"><!-- InstanceBeginEditable name="Left Column" --><?php include('../searchMembers.php'); ?><!-- InstanceEndEditable --></div> <div id="cont"><!-- InstanceBeginEditable name="Body Content" --> <?php $msg = (isset($_GET['msg']) AND $_GET['msg']<> "") ? urldecode($_GET['msg']) : ''; if ($msg <> "") { if (get_magic_quotes_gpc()) { $msg = stripslashes($msg); } echo "<div id='alertMessage'><p style='margin-left:40px;'>$msg</p></div>"; } // Get buddies $query_get_buddy = ("SELECT * from buddylink WHERE owner_id = '$id' AND status = '2'"); $get_buddy = mysql_query($query_get_buddy)or die("SQL Error: $query_get_buddy<br>" . mysql_error()); while ($buddy = mysql_fetch_assoc($get_buddy)){ $buddy_id = $buddy['buddy_id']; //Get buddy information $query_get_buddy_info = ("SELECT * FROM users WHERE user_id = '$buddy_id'"); $get_buddy_info = mysql_query($query_get_buddy_info)or die("SQL Error: $query_get_buddy_info<br>" . mysql_error()); while($buddy_info = mysql_fetch_assoc($get_buddy_info)){ //Get Buddies Albums $query_buddy_albums = ("SELECT * FROM albumNames WHERE user_id = '$buddy_id'"); $buddy_album = mysql_query($query_buddy_albums)or die("SQL Error: $query_buddy_albums<br>" . mysql_error()); $i = 0; while($album = mysql_fetch_assoc($buddy_album)){ $image = "../user_images/".$album['album_cover']; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=75; $newheight=($height/$width)*75; ////////// $col = ($i % 2) ? 'right' : 'left'; echo "<div class=\"$col\">";?> <table class="table" style="width:99%;"> <tr> <td rowspan="3" style="width:20%;" valign="top"> <a href="albumPhotos.php?photos=<?php echo $album['album'];?>&bid=<?php echo $buddy_id; ?>"><img src="../user_images/<?php echo $album['album_cover']; ?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" alt="<?php echo $album['album_cover']; ?>" /></a> </td> <td style="width:30%;" class="eventSub">Album:</td> <td valign="top"><?php echo $album['album']; ?></td> </tr> <tr> <td style="width:25%;" class="eventSub">Owner:</td> <td><a title="Go to members profile" class="linkText" href="../profile.php?=id=<?php echo $album['user_id']; ?>"><?php echo $buddy_info['first_name'].' '.$buddy_info['last_name'];?></a></td> </tr> <tr> <td style="width:25%;" class="eventSub">Created:</td> <td><?php echo $album['createdate']; ?></td> </tr> </table> <? echo "</div>"; $i++; } ?> <?php } }?> <div class="contentBottomSpace"></div> <!-- InstanceEndEditable --></div> </div> <div id="ftr"><!-- InstanceBeginEditable name="Footer" --><?php include('../design/ftr.php'); ?> <!-- InstanceEndEditable --></div> </div> </body> <!-- InstanceEnd --></html>
  4. Hi The below code is supposed to display tables side by side so to per row, It's kind of working until it gets to the last entry. In my sample query The divs are 1. left 2. right 3.left 4. left nuber 4 should be right. Any ideas why its not working $i = 0 $col = ($i % 2) ? 'right' : 'left'; echo "<div class=\"$col\">";?> <table class="table" style="width:99%;"> <tr> <td rowspan="3" style="width:20%;" valign="top"> <a href="albumPhotos.php?photos=<?php echo $album['album'];?>&bid=<?php echo $buddy_id; ?>"><img src="../user_images/<?php echo $album['album_cover']; ?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" alt="<?php echo $album['album_cover']; ?>" /></a> </td> <td style="width:30%;" class="eventSub">Album:</td> <td valign="top"><?php echo $album['album']; ?></td> </tr> <tr> <td style="width:25%;" class="eventSub">Owner:</td> <td><a title="Go to members profile" class="linkText" href="../profile.php?=id=<?php echo $album['user_id']; ?>"><?php echo $buddy_info['first_name'].' '.$buddy_info['last_name'];?></a></td> </tr> <tr> <td style="width:25%;" class="eventSub">Created:</td> <td><?php echo $album['createdate']; ?></td> </tr> </table> <? echo "</div>"; $i++; } ?> <?php } }?>
  5. Hi I need script that will convert a number say 03 to the month name in this case March. Thank you
  6. The last post worked, thank you for all the help
  7. how would I work that in
  8. I tested this code and it does not work it returns Wednesday, December 31 1969
  9. thank you for the post however I think there is a small glitch in the code 2008-03-11 returns March 03 2008 any idea why
  10. Hi I have a date value assigned to a variable $date which is in this format 2008-03-05. How would I use php to reorganize the date so that is reads Wednesday, March 05 2008 Thank you
  11. I figured out this much. Its returning the entries that I want but it including the entrys that the month is not found also, Its giving me the blank record. I found a fix by using an if statement however I never had a query do this before any thoughts
  12. Hi I have a query that is returning the correct information however its adding in blank rows, I reviewed my tables to see if there were records that would cause this. I'm lookig to have somthing returned to help me determine why there are extra recoreds returned. here is my code $sqlbuddy = " SELECT buddylink.owner_id, buddylink.buddy_id, users.first_name, users.last_name, users.DOB FROM buddylink LEFT JOIN users ON buddylink.buddy_id = users.user_id ".$qryUserDate ." WHERE buddylink.owner_id = $id". $exString; echo $sqlbuddy; $qrybuddy = mysql_query($sqlbuddy)or die("SQL Error: $sqlbuddy<br>" . mysql_error()); $sqlBuddy returns SELECT buddylink.owner_id, buddylink.buddy_id, users.first_name, users.last_name, users.DOB FROM buddylink LEFT JOIN users ON buddylink.buddy_id = users.user_id AND (month(users.DOB) = 03) WHERE buddylink.owner_id = 63 AND buddylink.buddy_id <>4 AND buddylink.buddy_id <>5 AND buddylink.buddy_id <>7 AND buddylink.buddy_id <>13 AND buddylink.buddy_id <>26 AND buddylink.buddy_id <>178 When I call the result <?php while($rbuddy = mysql_fetch_assoc($qrybuddy)) : ?> <?php echo 'Yes'.$rbuddy['DOB']; ?><br/> <?php endwhile; ?> I get Yes Yes Yes1953-03-19 Yes1990-03-05 Yes Yes1966-03-15 The Yes with no date next to them should not be there any help is great
  13. thank you for the post and guidance it helped me solve my problem
  14. Hi below is a query That I'm trying to get all entry that have the matching month in a a date column (Yes the column is set to date format ). For some reason its returning all found entries but only for the table children. the query $qryDate = " AND (month(parent.parentdob) = $eventMonth) OR (month(children.childdob) = $eventMonth) OR (month(sibling.siblingdob) = $eventMonth) OR (month(users.spousedob) = $eventMonth) OR (month(users.DOB) = $eventMonth)"; // $sql = "SELECT users.first_name, users.last_name, children.childdob, children.childfirstname, children.childlastname, sibling.siblingdob, sibling.siblingfirstname, sibling.siblinglastname, parent.parentdob, parent.parentfirstname, parent.parentlastname, users.DOB, users.spousedob, users.spousefirstname, users.spouselastname FROM users LEFT JOIN children ON children.owner_id = users.user_id LEFT JOIN parent ON parent.owner_id = users.user_id LEFT JOIN sibling ON sibling.owner_id = users.user_id WHERE" .$newQryDate." AND users.user_id = '$id'"; out put see anything wrong thanks SELECT users.first_name, users.last_name, children.childdob, children.childfirstname, children.childlastname, sibling.siblingdob, sibling.siblingfirstname, sibling.siblinglastname, parent.parentdob, parent.parentfirstname, parent.parentlastname, users.DOB, users.spousedob, users.spousefirstname, users.spouselastname FROM users LEFT JOIN children ON children.owner_id = users.user_id LEFT JOIN parent ON parent.owner_id = users.user_id LEFT JOIN sibling ON sibling.owner_id = users.user_id WHERE (month(parent.parentdob) = 03) OR (month(children.childdob) = 03) OR (month(sibling.siblingdob) = 03) OR (month(users.spousedob) = 03) OR (month(users.DOB) = 03) AND users.user_id = '63'
  15. I thought of something like this, where I add a to query to omit the found ids however its not working The query is repeated by the number of values found in the the array. any thoughts how to prevent this foreach ($UarrFamilyIds as $value): $exString = ' AND Buddylink.owner_id !='.$value; $sqlbuddy = "SELECT * FROM buddylink LEFT JOIN users ON buddylink.buddy_id = users.user_id WHERE buddylink.owner_id = '63' '$exString'"; $qrybuddy = mysql_query($sqlbuddy)or die("SQL Error: $sqlbuddy<br>" . mysql_error()); WHILE ($rbuddy = mysql_fetch_array($qrybuddy)) : //Buddy Birth days $exbuddyDOB = explode('-',$rbuddy['DOB']); $curbuddyDOB = $bYear .'-'. $exbuddyDOB[1] .'-'. $exbuddyDOB[2]; $arrEVENTS[$curbuddyDOB] = 1; //create buddy b-daystring $arrNamesBuddy[$exbuddyDOB[2].''.$exbuddyDOB[1]] = ('<br /><span style="font-size:8px;">'.$rbuddy['first_name'].' '.$rbuddy['last_name'].'<br/>B-day</span>'); ENDWHILE; endforeach;
  16. This is what the echo of $value returns 571326178 which is 5,7,13.26,178 If I replace the variable with the number 5 then the value I want omitted is gone. for some reason the foreach is not doing the trick
  17. I'm getting closer I believe this is simpler and a lot cleaner then my first post the problem is its not removing the values associated with the $value. any ideas why, when I echo the $value the correct information is displayed. any ideas $qryGetFamilyUserIds = "SELECT * FROM users, sibling, children, parent WHERE sibling.siblingfirstname = users.first_name AND sibling.siblinglastname = users.last_name AND sibling.siblingdob = users.DOB AND sibling.owner_id = '63' OR (parent.parentfirstname = users.first_name AND parent.parentlastname = users.last_name AND parent.parentdob = users.DOB AND parent.owner_id = '63') OR (children.childfirstname = users.first_name AND children.childlastname = users.last_name AND children.childdob = users.DOB AND children.owner_id = '63') OR (users.spousefirstname = users.first_name AND users.spouselastname = users.last_name AND users.spousedob = users.DOB)"; $GetFamilyUserIds = mysql_query($qryGetFamilyUserIds)or die("SQL Error: $qryGetFamilyUserIds<br>" . mysql_error()); while ($FamilyUserIds = mysql_fetch_array($GetFamilyUserIds)): $arrFamilyIds[] = $FamilyUserIds['user_id'].'<br />'; $UarrFamilyIds = array_unique($arrFamilyIds); endwhile; /*print_r ($UarrFamilyIds);*/ foreach ($UarrFamilyIds as $value): echo $value; $sqlbuddy = "SELECT * FROM buddylink JOIN users ON buddylink.buddy_id = users.user_id WHERE (buddylink.buddy_id <> '$value') AND (buddylink.owner_id = '63')"; /*echo $sqlbuddy;*/ $qrybuddy = mysql_query($sqlbuddy)or die("SQL Error: $sqlbuddy<br>" . mysql_error()); WHILE ($rbuddy = mysql_fetch_array($qrybuddy)) : //Buddy Birth days $exbuddyDOB = explode('-',$rbuddy['DOB']); $curbuddyDOB = $bYear .'-'. $exbuddyDOB[1] .'-'. $exbuddyDOB[2]; $arrEVENTS[$curbuddyDOB] = 1; //create buddy b-daystring $arrNamesBuddy[$exbuddyDOB[2].''.$exbuddyDOB[1]] = ('<br /><span style="font-size:8px;">'.$rbuddy['first_name'].' '.$rbuddy['last_name'].'<br/>B-day</span>'); ENDWHILE; endforeach; //
  18. this could be a simpler approach. however its not omitting the siblings found in the table users. if these three values match then dont include (sibling.siblingfirstname != users.first_name AND sibling.siblinglastname != users.last_name AND sibling.siblingdob != users.DOB) any ideas why this is not working $sqlbuddy = "SELECT * FROM users LEFT JOIN buddylink ON users.user_id = buddylink.buddy_id LEFT JOIN sibling ON sibling.owner_id = users.user_id LEFT JOIN children ON children.owner_id = users.user_id LEFT JOIN parent ON parent.owner_id = users.user_id WHERE buddylink.owner_id = '63' OR (sibling.siblingfirstname != users.first_name AND sibling.siblinglastname != users.last_name AND sibling.siblingdob != users.DOB)";
  19. HI, I'm trying to omit people who are found in the table users from the query, The first query $sqlCheckMember checks to see if the person is a member and if they are get their user_id. The user ID is stored in an array member_id[]. Which I then use in the query $sqlbuddy to see if that user_id is found in the table buddy link. If there is a match then I want that person omitted from the query hence buddylink.buddy_id != '$foundMemberId'". For some reason its not omitting the found ids. IF I replace $foundMemberId' with a hard value which a match occurs for that person is omitted. I think the problem is it's not looping correctly. $sqlCheckMember = ("SELECT first_name, last_name, DOB, user_id FROM users WHERE first_name = '$firstname' AND last_name = '$lastname' AND DOB = '$dob'"); $qryCheckMember = mysql_query($sqlCheckMember)or die("$sqlCheckMember Query Error: ".mysql_error()); while($parent_find = mysql_fetch_array($qryCheckMember)): $Member_id[] = $parent_find['user_id']; endwhile; endforeach; endforeach; //Get Current Year if(isset($_GET['m'])){ $bYear = substr($_GET['m'],0,4); }else{ $bYear = date('Y'); } $arrEVENTS = array(); $arrNames = array(); foreach($Member_id as $foundMemberId): $sqlbuddy = "SELECT buddylink.buddy_id, buddylink.owner_id, users.user_id, users.DOB, users.first_name, users.last_name FROM users LEFT JOIN buddylink ON users.user_id = buddylink.buddy_id WHERE buddylink.owner_id = '63' AND buddylink.buddy_id != '$foundMemberId'"; echo $sqlbuddy; $qrybuddy = mysql_query($sqlbuddy)or die("SQL Error: $sqlbuddy<br>" . mysql_error()); endforeach;
  20. hi here is what I got and I get an error message $qryGettitle = "Select * DATE_FORMAT(tstamp,date_posted) AS stamp FROM blog INNER JOIN blogtopics ON categoryID=catid any thoughts
  21. HI I have the the date and time stored in a mysql table field. How do I get just the time from the value. thank you
  22. Hi I have been using dream weaver but it just died, It will on open, It comes up then closes. I had this problem before and once I re formated my computer I was able to re install. any way this is not a Dream weaver question about 6mths ago someone sent me a link to a free program for writing webpage. does anyone have any recommendation on a free program , more geared for php programing __________________
  23. Is there a relationship between number of databases for a site
  24. Hi I was wondering when a person should consider adding another database. So far I have eighteen tables all are not to big as of yet.
×
×
  • 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.