Jump to content

proctk

Members
  • Posts

    300
  • Joined

  • Last visited

    Never

Everything posted by proctk

  1. hi when the below is clicked i want it to trigger some code at the top of the page. I code do it by passing a value through the url and using isset. I want to do it without passing a value through the url <a class="mailText" href="readmessage.php?m=<?php echo $sentMessages['message_id']; ?>"><?php echo $sentMessages['subject']; ?></a>
  2. its creating the link between message that have replys associated with it
  3. HI I'm looking for advice on how to setup my mysql table to handle reply to messages. Below is my current table structure. I could add another column replys any help or advice is great CREATE TABLE `messagecenter` ( `message_id` int(11) NOT NULL auto_increment, `sender_id` int(11) NOT NULL, `receiver_id` int(11) NOT NULL, `subject` varchar(255) collate latin1_general_ci NOT NULL, `message` text collate latin1_general_ci NOT NULL, `date_sent` datetime NOT NULL, `opened` varchar(50) collate latin1_general_ci NOT NULL, `date_opened` datetime NOT NULL, `status_to` varchar(50) collate latin1_general_ci NOT NULL, `status_from` varchar(50) collate latin1_general_ci NOT NULL, PRIMARY KEY (`message_id`)
  4. any ideas how to get the 't' to print in the date out put thank you
  5. very close its returning the correct date but still leaving the t out value = August 20 a 12:05 am should be August 20 at 12:05 am
  6. thank you for the help its closer what you posted returns this August 31 a 12:05 am its not the correct result based on the above
  7. the example posted on the php website do not work when one of the lets used to express a date or time value is use here is what I have date("F t \a\t\ g:i a", $sentMessages['date_sent']); ?> which returns December 31 a 7:33 pm the value stored in the variable is 2007-08-20 00:05:10 thanks for the help
  8. thanks for the help, do I need to reformat the date that is returned from the variable that is set from the myslq table
  9. it retuns this December 31 pm31 7:33 pm this should be 2007-08-20 00:05:10 unformated
  10. Hi I have a variable $dateTime which is set from a mysql query. The value will always be datetime as that is how the mysql column is set. I want to change the formating of the variable to return a value like august 19 at 3:30 pm any help or direction is excellent
  11. what I'm trying to do is called PHP and AJAX Live Search I found this site http://www.w3schools.com/php/php_ajax_livesearch.asp I edited the code to this the problem is this I get an error message when I do the search Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 if I change this var url="livesearch.php" to the name of the html page then I get no error message a search result is returned but if includes the page and all formating any ideas js var xmlHttp function showResult(str) { if (str.length==0) { document.getElementById("livesearch"). innerHTML=""; document.getElementById("livesearch"). style.border="0px"; return } xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="livesearch.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("livesearch"). innerHTML=xmlHttp.responseText; document.getElementById("livesearch"). style.border="1px solid #A5ACB2"; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } php page <?php //specify how many results to display per page $limit = 5; // Get the search variable from URL $var = @$_GET['q'] ; //trim whitespace from the stored variable $trimmed = trim($var); //separate key-phrases into keywords $trimmed_array = explode(" ",$trimmed); // check for an empty string and display a message. if ($trimmed == "") { $resultmsg = "<p>Search Error</p><p>Please enter a search...</p>" ; } // check for a search parameter if (!isset($var)){ $resultmsg = "<p>Search Error</p><p>We don't seem to have a search parameter! </p>" ; } // Build SQL Query for each keyword entered foreach ($trimmed_array as $trimm){ // EDIT HERE and specify your table and field names for the SQL query $query = "SELECT * FROM users WHERE last_name LIKE \"%$trimm%\" OR first_name LIKE \"%$trimm%\" ORDER BY last_name DESC" ; // Execute the query to get number of rows that contain search kewords $numresults=mysql_query ($query); $row_num_links_main =mysql_num_rows ($numresults); // next determine if 's' has been passed to script, if not use 0. // 's' is a variable that gets set as we navigate the search result pages. if (empty($s)) { $s=0; } // now let's get results. $query .= " LIMIT $s,$limit" ; $numresults = mysql_query ($query) or die ( "Couldn't execute query" ); $row= mysql_fetch_array ($numresults); //store record id of every item that contains the keyword in the array we need to do this to avoid display of duplicate search result. do{ //EDIT HERE and specify your field name that is primary key $adid_array[] = $row[ 'user_id' ]; }while( $row= mysql_fetch_array($numresults)); } //end foreach if($row_num_links_main == 0 && $row_set_num == 0){ $resultmsg = "<p>Search results for:" . $trimmed ."</p><p>Sorry, your search returned zero results</p>" ; } //delete duplicate record id's from the array. To do this we will use array_unique function $tmparr = array_unique($adid_array); $i=0; foreach ($tmparr as $v) { $newarr[$i] = $v; $i++; } // now you can display the results returned. But first we will display the search form on the top of the page foreach($newarr as $value){ // EDIT HERE and specify your table and field names for the SQL query $query_value = "SELECT * FROM users WHERE user_id = '$value'"; $query_get_members=mysql_query ($query_value); $members= mysql_fetch_assoc($query_get_members); $row_num_links= mysql_num_rows ($query_get_members); } echo $members['first_name']; ?> html page <style type="text/css"> #livesearch { margin:0px; width:194px; } #txt1 { margin:0px; } </style> <script src="../Scripts/livesearch.js"></script> </head> <body> <div id="container"> <div id="top"> <?php include('../design/topMenu.php'); ?> </div> <div id="subHeader"> <p> </p> </div> <div id="leftnav"> <?php include('../searchMembers.php'); ?> </div> <div id="Centercontent"> <form> <input type="text" id="txt1" size="30" onkeyup="showResult(this.value)"> <div id="livesearch"></div> </form>
  12. Hi can someone point me in the direction of script that will search a database and will offer a drop down that populates with the search results that can be selected to fill the textbox. Even the tech name for this so I can do some goole searching would be great
  13. Hi I was wondering if anyone has come across a tutorial or can give me some ideas on how to set up an effective error handling system. I currently pass the error message through the url and get the message to display on the page. thanks
  14. I was making this way to complicated I solved the issue
  15. Alright Its been days and I'm still banking my head on this one. The code should work but there is only one buddy_id showing when I echo $buddy_id within the while loop if I echo it outside the while loop all buddy Ideas show. I tried assigning the buddy Is to an array to bring them inside the while loop but its only returning the buddy ids that are found in the query help please I'm getting desperate $arrBuddy_id = array($buddy_id); //Gets buddies photo from thge table images if one exsists $query_get_photo = ("SELECT * FROM `image_files` WHERE `user_id` = '$buddy_id' AND `album` = 'Member'"); $get_photo = mysql_query($query_get_photo)or die("SQL Error: $query_get_photo <br>" . mysql_error()); while ($row = mysql_fetch_array($get_photo, MYSQL_ASSOC)) { print_r($arrBuddy_id); $countIds = mysql_num_rows($get_photo); if($buddy_id == $row['user_id']){ $image = "user_images/".$row['image_name']; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=75; $newheight=($height/$width)*75; ?> <a href="profile.php?id=<?php echo $buddy_id; ?>"><img src="user_images/<?php echo $row['image_name'] ;?>"width="<?php echo $newwidth; ?>" height="<?php echo $newheight?>" alt="<?php echo $row['image_name'];?>" /></a> <?php }} ?>
  16. This will display the image but gives an error message for the spots where the blank image is supposed to display ERROR Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\familyclick\buddyList.php on line 120 any yet another approach to this while ($row = mysql_fetch_array($get_photo, MYSQL_ASSOC)) { $ids[] = $row['user_id']; $image_file[] = $row[image_name]; } foreach($ids as $value){ foreach ($image_file as $file){ if ($buddy_id == $value){ $imageName = $file; $image = "user_images/".$imageName; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=75; $newheight=($height/$width)*75; } if($buddy_id != $value){ $imageName = 'blankAlbum.jpg'; $newwidth=75; $newheight=100; } } }
  17. alright the question is how do I compare the values in the variable $buddy_id to the values found from the query $photo['user_id']. A simple if should work but there will not alway bee the same number of value assigned to the two variables. Example $buddy_id was set for a while statement value [1] 2 value [2] 4 value [3] 5 $$photo['user_id'] value [1] = 2
  18. I just figured out a huge problem. not every person will be found in the table image_files. I need to figure out how to change my if statememt so that if the buddy id was not found in the table then display the blank image. I have edited my code to this which is not working because the $photo['user_id'] != $buddy_id) statement does not work as $photo['user_id'] != $buddy_id) has no value. the bottom line is if the nothing is found in the query then I want the blank image to display any help is excellent if ($photo['user_id'] == $buddy_id){ $imageName = $photo['image_name']; $image = "user_images/".$imageName; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=75; $newheight=($height/$width)*75; } elseif($photo['user_id'] != $buddy_id){ $imageName = 'blankAlbum.jpg'; $newwidth=75; $newheight=100; }
  19. I have got the code down to this if there is no value for $photo['image_name'] then the blank image should be displayed if ($photo['image_name'] !=""){ $imageName = $photo['image_name']; $image = "user_images/".$imageName; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=75; $newheight=($height/$width)*75; } elseif($photo['image_name'] ==""){ $imageName = 'blankAlbum.jpg'; $newwidth=75; $newheight=100; }
  20. I tried this and still the same issue the new part is this if (!empty($photo['image_name'])){ $imageName = $photo['image_name']; }else{ $imageName = 'blankAlbum.jpg'; } showing placement if($photoCount > 0){ $image = "user_images/".$photo['image_name']; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=75; $newheight=($height/$width)*75; if (!empty($photo['image_name'])){ $imageName = $photo['image_name']; }else{ $imageName = 'blankAlbum.jpg'; }
  21. I tied empty and that did not work. that did not help. this should not be so hard. a simple if else should really do the trick :'(
  22. i echoed $photoCount and where the was an image found the number 1 is returned, where there is no image found nothing is returned. any ideas whats wrong
  23. thanks for the post, I made the change and the same result occurs. If there is an image found then its displayed. If no image is found nothing is displayed. the image blank should display this one is confusing me
  24. This one has been giving me a hard time for a long while and I really need to help to get to the bottom of it. The goal is to display the users photo if one is found and if no photo is found then show the default "blankImage" if no image was found. The below displays both the blank image and the users image if an image is found. any help with this is greatly appreciated thank you //Gets buddies photo from the table images if one exists $query_get_photo = ("SELECT * FROM `image_files` WHERE `user_id` = '$buddy_id' AND `album` = 'Member'"); $get_photo = mysql_query($query_get_photo)or die("SQL Error: $query_get_photo <br>" . mysql_error()); while($photo = mysql_fetch_assoc($get_photo)){ $photoCount = mysql_num_rows($get_photo); ?> <?php if($photoCount > 0){ $image = "user_images/".$photo['image_name']; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=75; $newheight=($height/$width)*75; } ?> <img src="user_images/<?php echo $photo['image_name'];?>"width="<?php echo $newwidth; ?>" height="<?php echo $newheight?>" alt="<?php echo $photo['image_name'];?>" /> <?php } if(empty($photo['image_name'])){ ?> <a href="profile.php?id=<?php echo $buddy_id; ?>"><img src="user_images/blankAlbum.jpg" width="75" height="75" alt="blankAlbum.jpg" /></a><a href="profile.php?id=<?php echo $buddy_id; ?>"></a><?php } ?>
  25. thanks for the info with that being said how can I trigure to events with onclick onchange="return confirm('Are you sure you want to make this change?')","this.form.submit()">
×
×
  • 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.