Jump to content

jmrothermel

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jmrothermel's Achievements

Member

Member (2/5)

0

Reputation

  1. Im sorry to be stupid - I thought I did. Isnt the capital Y the php code for the 4 digit year format? $date = date("Y-m-d");
  2. I made the change to the user line as you stated along with changing the date to $date = date("Y-m-d"); Because I want a 4 digit year - month - day output. When I click the dropdown referral link and it processes I get this: feedall.php?action=feed&username=jmrothermel&date=08-12-15 Its only giving me a two digit year output. Why is that? Obviously I get a 0 lines affected because the date is the improper format. I will also start tidying up my code to start preventing SQL injection - something I hadnt really thought about before now.
  3. So I moved servers from a shared C-Panel plan to a VDS server (we were too large for the shared plan) Since then, basic queries that USED to work dont work anymore? But if I execute them directly in phpmyadmin they work just fine. For example: if($a == 'feed') { $user = $_GET['$username']; $date = date("y-m-d"); $check= mysql_query("SELECT * FROM pets WHERE `user`='$username'"); $check_num= mysql_num_rows($check); if ($check_num == "0"){ print "Record could not be found"; }else{ mysql_query("UPDATE `pets` SET `lastfed`='$date' WHERE `user`='$username'") or die (mysql_error()); printf ("Pets Fed: %d\n", mysql_affected_rows()); }} It will return the next page with Pets Fed: 0. But if I go into the database and go to SQL and type UPDATE `pets` SET `lastfed`='2008-12-15' WHERE `user`='username' It will return 143 affected rows. As I stated this worked just fine on the old server, the only thing different is the new server. No coding was changed. I am having this problem with ALOT of queries that I execute, so Im wondering if something needs to be added with the new server? Here is my information: Server version: 5.0.67 Protocol version: 10 Server: Localhost via UNIX socket User: h321760w@localhost MySQL charset: UTF-8 Unicode (utf8) phpMyAdmin - 2.10.1 MySQL client version: 5.0.24 Used PHP extensions: mysqli [ChangeLog] [subversion] [Lists]
  4. Hmmmmm I dont get any errors no, but it still doesnt update in the database. The users money field that should be 5000 less stays exactly the same. Any suggestions ???
  5. Ok I have a few commands going on at once. All seem to be executing except the first UPDATE. $update = mysql_query("UPDATE members SET money='$new' WHERE username='$username'"); Could anyone tell me why that might be? Here is the code I am using. if($a == 'feed') { $user = $_GET['$username']; $date = date("y-m-d"); $check= mysql_query("SELECT * FROM pets WHERE `user`='$username'"); $check_num= mysql_num_rows($check); if ($check_num == "0"){ print "Record could not be found"; }else{ $sql = mysql_query("SELECT `money` FROM `members` WHERE `username`='$username'"); $new = $sql - 5000; $update = mysql_query("UPDATE members SET money='$new' WHERE username='$username'"); $new2 = $MONEY + 5000; $insert=mysql_query("INSERT INTO `petsfed` SET `user`='$u', `fed` = '$username', `date` = '$date'"); $update2=mysql_query("UPDATE `members` SET `money`='$new2' WHERE `username`='$u'"); $insert2=mysql_query("UPDATE `pets` SET `lastfed`='$date' WHERE `user`='$username'") or die (mysql_error()); if($insert && $insert2 && $update && $update2) { printf ("Pets Fed: %d\n", mysql_affected_rows());
  6. SELECT * FROM `pets` WHERE `lastfed` < 'DATE_SUB(CURDATE(), INTERVAL 4 DAY' LIMIT 0 , 30 And dates is backwards for whatever reason. If I turn the carat around I get all the results WITHIN the last four days. (2-26 to 3-2) I want all results from before that. So thats definately the carat I want.
  7. Hmmmmmmmmmm no one wants to take a stab at this one? I told you its one wierd confusing script
  8. That is my whole query. When I go into the database Im going up to search at the top and in the field next to the date I select the "<" carat and type in the search box DATE_SUB(CURDATE(), INTERVAL 4 DAY I then click Go for the results.
  9. Ok this one is WAYYYYYYYYYYYYYYYY above my head. Someone wrote a login script for our page and its just total greek to me. It works fine (with the exception it doesnt log people off after so many minutes of inactivity which irritates me) but oh well. Theres one thing it doesnt do though. The way the script is set up here: Hmmmm it wont let me post my script? I'll try saving the whole post to a file and uploading it. Its on the functions page to insert the user and authcode into the insertonline serverdata.txt page (which it does) and also into the insertonlinetoday onlinetoday page (which it doesn't). (Also wouldnt let me insert - entire post is in the attachement) Can anyone see why it is inserting it into the one file (serverdata.txt) but not the other (onlinetoday.txt)? This is just way beyond my level of comprehension. I would like to ditch this whole script and go back to the old one but with the way its set up anymore I dont know if its possible
  10. I am doing this directly in MySQL - so its not a PHP coding issue or anything. I have a field that is date date No 0000-00-00 format. I am trying to do this query on it: < DATE_SUB(CURDATE(), INTERVAL 4 DAY Its returning no results - even though I know there is a line in there with the date 2008-01-29. Any suggestions why its not returning the result?
  11. That script worked ILYAS415. I must have had something wrong - but when I used your modified code it worked fine. Thank you soooooooooooooooo much!
  12. Heres the situation. Im using the following code: if($a == 'delete') { $id = $_POST['id']; $delete = mysql_query("DELETE FROM `adminrecord` WHERE `id`='$id'"); if($delete) { print "Record Deleted! <a href='chartview.php'>Return to Admin Chart</a>"; } else { print mysql_error(); } } And when I click the correct link I get the confirmation page. Record Deleted! etc etc etc but it doesnt really delete it from the database. Any suggestions? Thank you for all your help everyone - this site has gotten me through alot the past few days!
  13. Wow - thats all it took removing the slash since it was relative in the same directory. Im getting out of this coding business...... Im such an idiot ??? - thanks for the help
  14. Here is my code I wrote: <? include("1header.php"); include("members.php"); $a = $_GET['action']; if($a == ''){ $id = $_GET['id']; print "<br><br>Choose if this chinchilla is a breeder or a pet.<br><br><form action='/pet.php?action=set' method='post' enctype='multipart/form-data'> Choose an Option:<br> <select name='status' size='1'> <option value='breeder'>Breeder</option> <option value='pet'>Pet</option> </select> <input type='hidden' name='id' value='$id'> <input type='submit' value=' Set '></form>"; } if($a == 'set'){ $id = $_POST['id']; $pet = $_POST['status']; $update = mysql_query("UPDATE `pets` SET `pet`='$pet' WHERE `id`= '$id'"); if($update) { print "<h2>Your Chinchilla's pet/breeding status has been set. </h2><p> <a href='managepets.php'>Return to your pets</a> "; } else { print mysql_error(); } } include("footer.php"); ?> Any time I click the "set" button it takes me to a page not found 404 Error. Is there something Im not doing right in uploading the page/script?
×
×
  • 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.