cmgmyr
Members-
Posts
1,278 -
Joined
-
Last visited
Never
Everything posted by cmgmyr
-
Cool, that did the trick! I think I was reading into it a little more then I should have. Thanks!
-
try... UPDATE my_table SET my_column = my_column + 1 WHERE id = $id
-
I have a mail table: CREATE TABLE `mail` ( `mid` int(11) NOT NULL auto_increment, `parentid` int(11) NOT NULL default '0', `u_to` int(11) NOT NULL default '0', `u_from` int(11) NOT NULL default '0', `subject` varchar(100) NOT NULL default '', `message` text NOT NULL, `status` tinyint(1) NOT NULL default '0', `status2` tinyint(1) NOT NULL default '1', `date_sent` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`mid`) ) ENGINE=MyISAM; INSERT INTO `mail` (`mid`, `parentid`, `u_to`, `u_from`, `subject`, `message`, `status`, `status2`, `date_sent`) VALUES (1, 0, 1, 306, 'Hi!', 'This is the first message', 1, 1, '2007-08-10 00:11:44'), (2, 1, 306, 1, '', 'This is the second', 1, 1, '2007-08-10 00:12:06'), (3, 2, 1, 306, '', 'This is the third', 1, 1, '2007-08-10 00:12:35'); status is for the u_to, status2 is for u_from the status codes are 0=unread, 1=read, 2=deleted What I want to do is make a query that if one user deleted a message, the other user can still view it (if they didn't delete it). So in the exampe above both users read the thread. if you change status on mid #1 to '2' user number 1 shouldn't see it. User #306 should still be able to see it. How would I create this query? I have this so far: SELECT * FROM `mail` WHERE (u_to = $userid OR u_from = $userid) AND status != 2 AND parentid = 0 ORDER BY date_sent DESC but this doesn't show the message to the opposite user that deleted it. Please let me know if you need any more info. Thanks!
-
I have this script: <?php $table = "<table border=1>\n"; $sql = "SELECT id FROM categories LIMIT 1"; $result = $db->query($sql); while($row = $db->fetch($result)){ $id = $row['id']; $table .= " <tr> <td>$id</td> <td>".$catalog->crumbs_category2($id)."</td> </tr> "; } $table .= "</table>"; echo $table; ?> <?php function crumbs_category2($cat_id, $level=0) { global $db; $sql = "SELECT parentid, name FROM categories WHERE id = $cat_id"; $result = $db->query($sql); list ($p, $n) = $db->fetchRow($result); if ($p != '0') $this->crumbs_category2($p, $level+1); echo ($p == '0') ? "$n " : "- $n "; } ?> and it outputs this: Why is this data not printing in the table? Thanks!
-
Check this out and click "Download paypal.php" http://www.belahost.com/pp/
-
google has picasa
-
do you have access to the database on the other server?
-
it would probably be easier to do this before you enter the data into the database. but as Foser said you can easily do this with regex, just loop through your data and apply your regex. if you don't know how to do it there is a board on here that can help you.
-
Well you should really have a table for users, jobs, job_users, and files users ----- userid name phone email ect... jobs ----- job_id name ect... job_users (This is to give users access to certain jobs) ----- ju_id userid job_id ect... files ----- file_id job_id name file type ect... hope that sends you in the right direction
-
why would you write the data to the file, then the same data to the database? Can you write out your whole procedure for us...I'm sure we can give you a better solution
-
What do you need the csv for? Do you really need to update it that much? ...Why don't you just pull the information from the database when you need it instead of running this function all the time? It would certainly speed things up.
-
Can I ask what you are doing with that look that you need to do it 1000 times???
-
Well I have a few takes on this, hopefully it will help you out. 1. What I usually do if I have control over what the users are uploading (say .jpg's only) I set up a directory that they upload to and I rename the file to a random 16 char file name (so pretty much you can have a lot of them without worrying about if there are 2 files with the same name...even though you should still check.) Then I just store that file name in the database. This means that the database carries very little data. 2. If I have no control over what they are uploading (different files types) I've used a blob in the database and a varchar to store the file type. Then when they call you download it, the file type goes in the header, and you print the blob (short version). This is good so that you don't need to worry about what they upload, but if you do this your database is going to get VERY large quickly, which this would be true for you because they would be uploading very large files. I think that you should go with #2, but there is no reason to have more then 1 table to hold this data. You can just make a column for "project_type" to hold if it's a job, img, etc... Hope this helps you out!
-
try this: <?php function crumbs($id, $level=0) { $sql = "SELECT parentid, name FROM cats WHERE id = $id"; $result = mysql_query($sql); list ($p, $n) = mysql_fetch_row($result); if ($p != '0') crumbs($p, $level+1); echo ($p == '0') ? "$n " : "ยป $n "; } ?> hope that helps
-
well as everyone said before the colors are bad. I don't want to stay on a page very long if it looks like someone took a dump on my screen. You also need content. No one wants to go to a site and be the first to post things. Make a few dumby accounts for yourself and go around the internet and find content for your site and submit it with those accounts (so it looks like more then just you (the admin) is posting things). Once you have good content then the people will come back.
-
try... select * from users where userid = $_SESSION['userid']
-
Cool, thanks for those. I actually went ahead and made this new messaging system. It works really well. It's a lot better then the older version that I mentioned. I already got good feedback from the upgrade
-
hmm that second return did the trick. Thanks! Here is the updated code. <?php function getChildMess($mid, $userid, $x=0){ global $db; $new_sql = "SELECT * FROM mail2 WHERE (`to` = $userid OR `from` = $userid) AND `status` != 2 AND `parentid` = $mid LIMIT 1"; if($db->numRowsQ($new_sql) > 0){ $new_result = $db->query($new_sql); while($new = $db->fetch($new_result)){ $new = $this->cleanArray($new); $status = $new['status']; $date = $new['date_sent']; $mid = $new['mid']; $message = $this->shortDesc($new['message'], 50); } $x++; return $this->getChildMess($mid, $userid, $x); }else{ if($x > 0){ $new_sql = "SELECT * FROM mail2 WHERE (`to` = $userid OR `from` = $userid) AND `status` != 2 AND `mid` = $mid LIMIT 1"; if($db->numRowsQ($new_sql) > 0){ $new_result = $db->query($new_sql); while($new = $db->fetch($new_result)){ $new = $this->cleanArray($new); $status = $new['status']; $date = $new['date_sent']; $message = $this->shortDesc($new['message'], 50); return array("status" => $status, "date" => $date, "message" => $message); } } } } } ?>
-
at the very bottom of the script you will see return array("status" => $status, "date" => $date, "message" => $message); This repeats the function if there is another newer message $this->getChildMess($mid, $userid, $x); The $x is only there to see if there is more then 1 newer message...if there isn't it will just take the older (parent) information (not shown)/ Thanks
-
I'm trying to make a "facebook" type messaging system. In your inbox you have conversations, if there has been a newer post to the conversation this function is supposed to overwrite the old information with the new. So pretty much taking the child message instead of the parent.
-
nope...nothing
-
@akitchin: I have 2 accounts through guru, one for a pro and one for an employer. Besides that one story I shared I've done pretty well on guru as an employer (I usually get flash stuff done through there), as a pro I've done very well. It's pretty much how I got my start. There has been a few not so good projects that have come my way, but I got through them. I haven't spent a lot of time on there recently because my really good clients want more of me now and I no longer need to look for projects or time fillers. Right now I have a ranking of 123 in the Website Design / Website Marketing category. But this used to be under 100 less then 6 months ago when I was on there alot. I would recommend guru to people who are starting out that need to get stuff in their portfolio fast. Plus you can actually get paid decently on there as opposed to scriptlance.com type places where people only want to pay $150 for myspace. Plus on that site you need to pay to bid if you get the project or not...not cool. @ober: I'd be up for something like that
-
Why is this function not returning my array? When I print it out within the function it works fine. <?php function getChildMess($mid, $userid, $x=0){ global $db, $bug; //echo "mid: $mid, userid: $userid, x: $x <br />"; $new_sql = "SELECT * FROM mail2 WHERE (`to` = $userid OR `from` = $userid) AND `status` != 2 AND `parentid` = $mid LIMIT 1"; if($db->numRowsQ($new_sql) > 0){ $new_result = $db->query($new_sql); while($new = $db->fetch($new_result)){ $new = $this->cleanArray($new); $status = $new['status']; $date = $new['date_sent']; $mid = $new['mid']; $message = $this->shortDesc($new['message'], 50); } $x++; $this->getChildMess($mid, $userid, $x); }else{ if($x > 0){ $new_sql = "SELECT * FROM mail2 WHERE (`to` = $userid OR `from` = $userid) AND `status` != 2 AND `mid` = $mid LIMIT 1"; if($db->numRowsQ($new_sql) > 0){ $new_result = $db->query($new_sql); while($new = $db->fetch($new_result)){ $new = $this->cleanArray($new); $status = $new['status']; $date = $new['date_sent']; $message = $this->shortDesc($new['message'], 50); return array("status" => $status, "date" => $date, "message" => $message); } } } } ?> ...and this doesn't print anything <?php $new_array = $func->getChildMess(1, 1); echo "<pre>"; print_r($new_array); echo "</pre>"; ?> also...if there is an easier way to do this. please feel free to share. I'm trying to get the last message in a conversation. Thanks, -Chris
-
How come you didn't make the form? It seems simple enough to do... I had one experience with an outsource company the I hired...I had this one project that was really just a pain in the ass and I didn't feel like working on it anymore, plus didn't have the time so I decided to look for someone to finish it. So I put an ad up through guru.com and found a company that sounded half way decent. In the project description I clearly put "This needs to be done within 1-2 weeks at the most...please do not bid if you can not complete this within that time frame" Simple right? Well after I got half the money in escrow (that day) I sent him more detailed information and told him to let me know it he needed anything else. After a week went by I finally heard back from him and he was asking simple/dumb questions, I answered those so he could move one. 2 weeks went by, 3 weeks went by...on the 5th week of bearly hearing from him my client despirately needed this project done. So I had to stay up all night (after working a regular 9 hour day) to finish this stupid project. Needless to say he didn't get paid. moral of the story: just do it yourself, it's a lot easier, and NEVER pay anyone until you have a finished product that works like what was agreed to in the initial contract.
-
I have a private messaging system on my site right now thats pretty simple and gets the job done. But I want to make it better and more efficient. Right now I have: CREATE TABLE `mail` ( `mid` int(11) NOT NULL auto_increment, `uidto` int(11) NOT NULL default '0', `uidfrom` int(11) NOT NULL default '0', `subject` text NOT NULL, `message` text NOT NULL, `status` tinyint(1) NOT NULL default '0', `status2` tinyint(1) NOT NULL default '0', `date` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`mid`) ) ENGINE=MyISAM ; for the database. What I'm doing is if you reply to a message it puts the last message below it and you type your new message on top This is my reply -------------- This is this original so as you can imaging after a few messages back and fourth the body of the message gets pretty big. What I want to do is set it up kind of like Facebook. Having parent_id's for messages and having a recursive function flip through them all in a "conversation" instead of having the whole conversation in one DB entry. What do you think about doing this the new way with the recursive function? Do you forsee any problems with this? Any other ideas that you would like to pass along? Thanks, -Chris