-
Posts
88 -
Joined
-
Last visited
Never
Everything posted by sean04
-
Hmm. I've run into a small issue. It seems that when I then reply to a message, that conversation then disappears. I think not having 'where to_user = $this->user_id' in the query causes this?
-
Thanks for the help Barand. I appreciate it. The query works great! In your opinion though is this the right way to approach this? Should I have two different tables one for the start of new messages and one that holds the conversations if you reply? Then I can just join those two tables. Thanks!
-
The problem is is that any message the doesn't have a reply to it yet has to show up and messages that have a reply to it the most recent has to show up. Any ideas? Thanks!
-
Thanks for the response. Yes, I'm trying to make a continuous message system. When a new message is started it has a reply id of 0. A person can then reply to that message. Pretty much trying to attempt what Facebook does. One message should show in the inbox and that should be the last reply to you. When you click on the message you can then see all the conversation messages. I was pretty sure this is the way to do it but if there is another way please explain. Thanks for the help!
-
I have a table as follows: id reply_id to_user from_user message date_sent ------------------------------------------------------------------------ 1 0 345 223 hey 2012-06-01 12:33:23 2 1 223 345 hey man 2012-06-01 12:37:23 3 1 345 223 how r u? 2012-06-01 12:45:23 4 0 223 345 sup 2012-06-01 13:17:23 5 4 345 223 msg 2012-06-01 13:37:23 6 4 223 345 msg2 2012-06-01 13:58:23 7 0 345 222 test 2012-06-02 09:33:23 How do I show the most recent message in a conversation and not all of them? Inbox should look like this... test 2012-06-02 09:33:23 how r u? 2012-06-01 12:45:23 msg2 2012-06-01 13:58:23 I've gotten close but I run into difficulties because any message with a reply_id of 0 needs to show up ONLY IF its never been replied to. If it has been replied to it shouldn't show up. Thanks in advance!
-
Hey, I have a news ticker that I'm attempting to make look smoother but am having no luck. Code is as follows: $(function () { $('#listticker').hover(function () { clearInterval(runTicker); }, function () { runTicker = setInterval(newsticker, pause); }); }); function newsticker() { last = $('ul#listticker li:last').hide().remove(); $('ul#listticker').prepend(last); $('ul#listticker li:first').slideDown(1000); } var runTicker = setInterval(newsticker, pause); The original idea came from here: http://woorktuts.110mb.com/newstickerjq/index.html but this is modified for what I need. As of now "new" articles slide down from the top and the last leaves from the bottom. The whole animation just looks a little clunky. Can anyone improve what I got so far? Thanks in advance!
-
Hey guys, I've been working with this rating system and I'm wondering if anyone can lead me in the right direction to make a read only or average set of stars. Can't seem to get around that. http://www.switchonthecode.com/tutorials/how-to-build-a-star-ratings-jquery-plugin Thanks, Sean
-
pretty much copy a record but update one field in that record
-
What I'm wondering is is there a way to update one field in a table while all the other fields in that table are the same as where you are copying it from? From my first example there could be 100 fields that need to be inserted to make a new record but the only field that needs actual changing is OfficeID. I need a query that wouldnt need me to enter all 100 fields to change a single field. Something like this INSERT INTO tbl_packages SELECT OfficeID, * WHERE OfficeID = 4100 I know the above is hard to understand because it doesnt make sense lol but i hope one of you will understand what im trying to do Thanks, Sean
-
Thanks for all the comments guys. I will try this out on Monday and if I run into any problems I'll be back here Thanks, Sean
-
So for example I have a table as such: PackageID OfficeID NumUsers 1 2333 55 2 2333 55 How would I go about writing a query that would copy that exact information for the Package Table but to a different OfficeID? So after I run the query the Package Table would be like this: PackageID OfficeID NumUsers Name 1 2333 55 Example 2 2333 55 Example 1 4100 55 Example 2 4100 55 Example This was my idea: $q1 = mysql_query ('SELECT * FROM tbl_packages WHERE OfficeID = \''.$_GET[OfficeID].'\''); while ($r1 = mysql_fetch_array($q1)) { mysql_query(' INSERT INTO tbl_packages ( PackageID, OfficeID, NumUsers, Name ) VALUES ( \''.$r1[PackageID].'\', \''.$_GET[OfficeID].'\', \''.$r1[NumUsers].'\', \''.$r1[Name].'\', ) '); Only problem is is that this way would take forever if there was 100 fields in the Packages table... maybe a subquery? Thanks, Sean
-
Yes the connection works and the chdir. I do get a permissions error sometimes but I have full permissions. Any ideas?
-
Copying files
-
What I'm trying to do is copy all files from one server to another folder on another server. Here is what I have have so far.. <?PHP //connection settings $ftp_server = "server"; $ftp_user_name = "user"; $ftp_user_pass = "pass"; $dir = "/var/test/"; $destination_file = "/test/"; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name"; } if (ftp_chdir($conn_id, $dir)) { echo " <br/>Current directory is now: " . ftp_pwd($conn_id) . "\n<p/>"; } else { echo "Couldn't change directory\n<p/>"; } $buff = ftp_rawlist($conn_id, $dir); foreach($buff as $files) { echo $files. "<br/>"; if (ftp_get($conn_id, $destination_file."test.file", $dir."test.txt", FTP_BINARY)) { echo "<br/>Successfully written to $destination_file\n"; } else { echo "There was a problem\n"; } ?> That doesn't work. Any ideas? Thanks, Sean
-
Thank you both for your replies. mgallforever, it worked perfectly thanks! Thanks, Sean
-
I have say about 7 different interests and beside each interest I want a check box. How would I go about having multiple check boxes checked so I can remove however many interests at one time... For example: [Checked] Hockey Soccer Baseball [Checked] Basketball And the remove all selected button would remove the checked interests. Thanks, Sean
-
Ok I got it working finally. I just need to know if this is the proper way to do it? If there is something that would work better please let me know. function GetFriends($User_ID){ if($User_ID != null){ $getUserFriends = mysql_query("SELECT * FROM user_friends WHERE $_SESSION[userID] = '$User_ID'") or die(mysql_error()); $totalUserFriends = mysql_num_rows($getUserFriends); while ($UserFriends = mysql_fetch_array($getUserFriends)) { echo"<div class=ViewList>"; $getFriendInformation = mysql_fetch_array(mysql_query("SELECT * FROM `viewInformation` WHERE `User_ID` = '$UserFriends[Friends_User_ID]'")); if($getFriendInformation[Picture_Link] != "") { echo"<a href='user_profile.php?User=$getFriendInformation[user_ID]'><img src='$getFriendInformation[Picture_Link]' border='2' height='75' width='75'></a><p/>"; }else{echo"<a href='user_profile.php?User=$getFriendInformation[user_ID]'><img src='".$defaultProfilePicture."' border='2' height='75' width='75'></a><p/>"; } echo "<a href='user_profile.php?User=$getFriendInformation[user_ID]'>$getFriendInformation[screen_Name]</a> - "; echo "<a href='?verifydelete&quickViewUser=$getFriendInformation[user_ID]'>Remove</a><br><p/></div>"; } return $UserFriends; } This is what I use to call the function: User::GetFriends(1); Suggestions? Thanks, Sean
-
Thanks! Another question... how would I get this to output on the profile page? Here is the function: function GetFriends($User_ID){ if($User_ID != null){ $getUserFriends = mysql_query("SELECT * FROM `userfriends` WHERE `User_ID` = '$User_ID'") or die(mysql_error()); $totalUserFriends = mysql_num_rows($getUserFriends); while ($UserFriends = mysql_fetch_array($getUserFriends)) { $getRequesterInfo = mysql_fetch_array(mysql_query("SELECT * FROM `viewInformation` WHERE `User_ID` = '$UserFriends[Friends_User_ID]'")) or die(mysql_error()); //gets requests if($getRequesterInfo[Picture_Link] != "") { echo"<a href='user_profile.php?User=$RequesterInfo[user_ID]'><img src='$RequesterInfo[Picture_Link]' border='2' height='75' width='75'></a><p/>"; }else{echo"<a href='user_profile.php?User=$RequesterInfo[user_ID]'><img src='".$defaultProfilePicture."' border='2' height='75' width='75'></a><p/>"; } echo "<a href='user_profile.php?User=$RequesterInfo[user_ID]'>$RequesterInfo[screen_Name]</a> - "; echo "<a href='?verifydelete&quickViewUser=$RequesterInfo[user_ID]'>Remove</a><br><p/></div>"; } return(GetFriends); } That function is in a class called User... Here is what I'm using on the profile page to call it: $user = $User->GetFriends($User_ID); And that doesn't work lol... I know it probably need a lot of cleaning up and i know I'm not returning the correct value lol. Thanks for any help, Sean
-
Actually what I've done doesn't really make any sense i guess lol. Thanks, Sean
-
Thanks! I will give this a try! Do you recommend anything like this as a function? function LoadUser($userID){ //$db = new Database(); $results = mysql_fetch_array(mysql_query("SELECT * FROM userInfo WHERE User_ID = '$userID'")); $UserID = $results[userID]; $Email_Address = $results[Email_Address]; $Password = $results[Password]; $Name = $results[Name]; $Screen_Name = $results[screen_Name]; return $results; } or should i just implement that right in the profile page? Thanks, Sean
-
Yes it does contain a Database class Thanks for the reply! So I wouldn't do anything like I posted right? Like loading all the users information? or should I just do that on the profile.php Thanks again, Sean
-
Can someone give me a hand on getting this working maybe how to use it and what not.. I'm trying but not very successful lol. I want to call the loaduser on the profile page.. <?php include "Database.php"; class User{ //Constructor - Create a new user function User(){ } //Constructor - Load an existing user function LoaddUser($userID){ $this->LoadUser($UserID); } function LoadUser($userID){ //$db = new Database(); $results = mysql_fetch_array(mysql_query("SELECT * FROM userInfo WHERE User_ID = '$userID'")); $UserID = $results[userID]; $Email_Address = $results[Email_Address]; $Password = $results[Password]; $Name = $results[Name]; $Screen_Name = $results[screen_Name]; return $results; } } ?> Thanks, Sean
-
All loggedInfo is is a sql statement $loggedInfo = select * from table where userid = loggedInUser Thanks, Sean
-
Ah so can I do this? foreach($loggedInfo as $name => $val) { if(!empty($val)) { echo "$name: $val<p/>"; echo "$birthday: $val<p/>"; echo "$location: $val<p/>"; } else { echo "<a href='edit_profile.php'>edit this!</a>"; } } Or like individually? foreach($loggedInfo as $name => $val) { if(!empty($val)) { echo "$name: $val<p/>"; } else { echo "<a href='edit_profile.php'>edit this!</a>"; } } foreach($loggedInfo as $name => $val) { if(!empty($val)) { echo "$birthday: $val<p/>"; } else { echo "<a href='edit_profile.php'>edit this!</a>"; } } Thanks, Sean
-
Glad to see your better Thanks for the reply! Sorry but im not sure if I understand. Where would I put like name, birthday, city etc..? Thanks, Sean