Jump to content

chinclub

Members
  • Posts

    34
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

chinclub's Achievements

Member

Member (2/5)

0

Reputation

  1. I am writing a simple blog script. I have been looking for a tutorial that goes beyond the very basics. The one thing I can't find a code for is how to deal with the line break that tells the script to stop there and add the (Read more) link. In my basic php knowledge I know I could just have two seperate fields in the post column, one for the intro part and one for the remainder of the article. I was wondering if this was the right way or if there was something easier. Any help would be great.
  2. I have written a PHP script and now I am learning how much I don't know because althugh my site only have 20 people or less on at a time I have too many clicks per second and have crashed my webhost. I then had to buy a dedicated server just to keep it active until I can figure out where to go to hire someone to help me optimize my script. In the mean time she sent me a readout of the processes running. Many of them I recognized as actioned called by my PHP scripts but there were a ton of these: 8 fsvzwtpl_virtual localhost fsvzwtpl_virtualpet Sleep 1 NULL 11 fsvzwtpl_virtual localhost fsvzwtpl_virtualpet Sleep 7 NULL etc... What is that and what might cause it? Also, does anyone know where I might could go to find someone to help optimize my scripts?
  3. Thanks for that link. It looks like I might need to have used BIGINT instead. Can I change the type to that using Edit Field without hurting the info in that field?
  4. The site I am running now is my first experience with PHP and SQL. The script came with automatic table setup in the database. The site has been live for 3 months and now we learn that there is a cap on the amount of points people can have. I looked at the database and it is set up with that field as type int(11). Common sense is telling me I can just edit that field and change the 11 to like 100 and never have to worry about it again. Am I right that this will fix the problem? And since this is a live site will changing the type field hurt the data already stored in that field in the table? I know that I should backup the database before I make changes but my problem is that the site is so big and I am on dial-up that it takes about 1 hour for me to make the backup and in an hour a lot of people have already logged in and done stuff. I want to be sure I take every precaution to be sure I am doing the right thing before I go messing with the database. Thanks for your patience with this very newbie question!
  5. I need a little help writing a piece of code. I have added a $lastvisit field to my database table as type date. So it records as YYYY-MM-DD. I can't seem to figure out the PHP code to figure the time between dates. I want to have the database retrieve the $lastvisit then have PHP code check that date against todays date and figure how many days it has been as something like: $timelapse = $NowDate - $lastvisit; I know that isn't correct (as I have tried it and just gives $timelapse = 0) and all of the date info I can find tells how to call info from the database by date but not how to figure time between dates. I want to be able to take that $timelapse and then return different responses for different dates by if ($timelapse > 2){print"whatever";} Can anyone point me in the right direction?
  6. I know how to delete, insert, and update an item in the database using PHP. Is there a way to do multiple items as once? For example. I have written in simple messaging system for my members. Right now there is a link beside each message to delete it from the database. And I use this simple code to do it: $del = mysql_query("DELETE FROM `messages` WHERE `id`='$id'"); I would love to have a check box beside each one and then a delete button at the bottom so you can delete multiple messages at once. I am good with writing the HTML for that but how would the PHP code look that would delete each of the messages they have chosen? I have tried finding a tutorial for this on the web but no luck yet.
  7. I am writing a new auction script for my website and I have everything working except closing the auctions. I have the database set up to record the start time like this: Field Type Default time datetime 0000-00-00 00:00:00 I want to set up a cron job that will close all auctions that are 10 days old. My only problem is I don't know how to write the code the find the 10 day cutoff. I know I need to somehow take today's day and subtract 10 days from it but I can't seem to find out how. My plan is once I find that code I will then take that variable and compare it to the time in the database with >. can anyone help?
  8. I am writing a script where I want it to check for several items in the database. If any one of those items isn't there I want it to give an error. If all items are there I was it to go to the next page. I have done one step checks before but never multiple. I have it set like this: $check = mysql_num_rows(mysql_query("SELECT * FROM `items` WHERE `user`='{$_COOKIE['ipets']}' AND `name`='baby safe cage' AND `equipped`='1'")); $checkaid = mysql_num_rows(mysql_query("SELECT * FROM `items` WHERE `user`='{$_COOKIE['ipets']}' AND `name`='first aid kit' AND `equipped`='1'")); $checksup = mysql_num_rows(mysql_query("SELECT * FROM `items` WHERE `user`='{$_COOKIE['ipets']}' AND `name`='Supplement kit' AND `equipped`='1'")); $checksvet = mysql_num_rows(mysql_query("SELECT * FROM `items` WHERE `user`='{$_COOKIE['ipets']}' AND `name`='vet directory' AND `equipped`='1'")); but I am not sure how to write the next line. Would I write all checks together like this: if($check == 1 && $checkaid == 1 && $checksup == 1 && $checksvet == 1) or am I totally wrong all together on this?
  9. I have a pretty large password protected community using .htpasswd. Now that I am getting the hang of PHP I would like to create a new member area using PHP and cookies so members didn't have to sign into every script. It would take forever to move all of that info into a database. Is there a way to use PHP to let someone log in and check their user info against the .htpasswd file? I've looked all over the internet but the only scripts or tutorials I could find were on writing passwords to the file not logging people in using them.
  10. try changing $img_path = "./"; to $img_path = "/home/username/public_html/img/"; your path to your directories will look different from that depending on your host, but you get the idea.
×
×
  • 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.