Jump to content

Hobbyist_PHPer

Members
  • Posts

    119
  • Joined

  • Last visited

Everything posted by Hobbyist_PHPer

  1. MySQL Version --> 5.0.76-standard Hi everyone, I have my first MySQL dedicated server and I'm finding some things to be a bit more challenging than I had expected... I have figured out how to create databases and even how to create a user for that database... But what I need to try to figure out is how to create a dump file of a database, so that I can then use that dump file to recreate all of the tables inside of newly created databases... Here's what I tried for creating a dump file... attorney is the name of the user and the database... mysqldump -u attorney -p password attorney > acsdumpfile.sql; Here's the error I get... ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqldump -u attorney -p password attorney > acsdumpfile.sql' at line 1 Then I tried doing this instead, copying the contents from one database to a newly created one, that didn't work either... mysqldump -u attorney -p password -d attorney | mysql -u attorney -p password -d staging; Here's the error I get... ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqldump -u attorney -p password -d attorney | mysql -u attorney -p passw' at line 1 <-- (I noticed here that it had cut off my password)
  2. Yeah, thanks, but if only it were that easy... You see it won't let me make permission changes like that, and if I logged in as root and made those changes, then they could only be modified by root, and I certainly don't want to put my root information into a php script...
  3. It won't be in any cPanel settings... you have to SSH into the server and change the permissions manually... I probably need to find a Linux/cPanel forum and ask...
  4. I'm pretty sure it's a cPanel set permission thing, just have to go into the server and change it somehow, I just can't remember how...
  5. Warning: copy(/home/mydirectory/public_html/8_newdirectory/acontentpage.php) [function.copy]: failed to open stream: Permission denied in /home/mydirectory/public_html/account/CreateNewAccount.php on line 70
  6. Hello everyone, so I made this script that creates directories via "a hack around" cPanel, on my own server, in order to create directories via my own software, but I also need to copy files from one directory into that newly created directory... Therein lies the problem... I created a script a few years ago that worked, but for the life of me I can't remember how I enabled myself to be able to use the copy function of php... Anybody know?
  7. I like that, that's some really nice coding... Thanks again for the help... Note taken on query...
  8. That makes sense... So basically it's just as well to write it out unless you have a lot of values to check against, in which case you would put them in an array and check against them that way...
  9. Really, because I can't it to work... If I have Trial Ended in the field, it doesn't work... but if I have Trial in the field, it does work... Even tried this... if ($row['CustomerSaas'] == 'Yes' && ($row['CustomerSaasPaidStatus'] == ('Trial' || 'Trial Ended'))) {
  10. In php is there a way to shortcut logical operators... example: if ($row['CustomerSaas'] == 'Yes' && ($row['CustomerSaasPaidStatus'] == 'Trial' || $row['CustomerSaasPaidStatus'] == 'Trial Ended')) { to if ($row['CustomerSaas'] == 'Yes' && ($row['CustomerSaasPaidStatus'] == 'Trial' || 'Trial Ended')) {
  11. That's it, thank you, I couldn't remember ... You're a Genius
  12. Actually, had to make one minor change to make the amount of days come out right, I didn't notice it at first until I started changing the date in which they signed up... (60 - DATEDIFF(DATE_ADD(CustomerSaasDateStarted, INTERVAL 60 DAY),CURDATE())) as DaysRemaining
  13. Hi everyone, I used to know the function, but it was a very long time ago, for when you need to just extract a single value from a query... instead of having to use mysql_fetch_assoc in a while loop to build an array... e.g. $TheResultingFieldValue = mysql_fetch_SOMETHING(mysql_query("SELECT aField FROM aTable WHERE anotherField = 'aCondition'"));
  14. Thank you, that worked perfectly, never thought to do it in the query...
  15. Cannot seem to get a grip on this whole subtracting 2 dates things... I need to find out how many days are left from the subtraction... This gives the wrong output, but like a month's worth... $CustomerSaasDateStarted = $row['CustomerSaasDateStarted']; $CustomerSaasDateStartedPlusSixtyDays = date('Y-m-d', strtotime($CustomerSaasDateStarted.' '.'+60 days')); $TheCurrentDate = date('Y-m-d'); $TheCurrentDate = new DateTime($TheCurrentDate); $CustomerSaasDateStartedPlusSixtyDays = new DateTime($CustomerSaasDateStartedPlusSixtyDays); $DifferenceInterval = $TheCurrentDate->diff($CustomerSaasDateStartedPlusSixtyDays); echo $DifferenceInterval->d.' Days Remaining on Trial<br /><br />
  16. Ok, figured out how to add 60 days to a mysql date... $CustomerSaasDateStartedPlusSixtyDays = date('M d, Y', strtotime($CustomerSaasDateStarted.' '.'+60 days')); Now just need to figure out how to subtract the current date from that... will post code if I figure it out...
  17. Hi all, I am trying to figure out how to add 60 days to a mysql stored DATE, then subtract the current date from that date to see how many days there are... Its for a 60 day trial and when they signed up, it put the date in which they signed up in the database table... Here's what I have, but it's not working... But I can't get it to add 60 days to a mysql stored DATE,... then of course I have to figure out how to do the subtraction... $CustomerSaasDateStarted = $row['CustomerSaasDateStarted']; $CustomerSaasDateStartedPlusSixtyDays = date("Y-m-d", strtotime($CustomerSaasDateStarted, "+60 days")); // Test Output echo 'Date Trial Started: '.date("M d, Y", strtotime($CustomerSaasDateStarted)); echo '<br />'; echo '60 days from Date Trial Started: '.date("M d, Y", strtotime($CustomerSaasDateStartedPlusSixtyDays)); echo '<br />';
  18. Thank you very much for that... That is a lot of great information that I will start integrating into my code...
  19. So all in all, what's the best way to insert POST data into the db?
  20. It just doesn't insert into the database The other piece of code that uses that AccessLog INSERT statement, that you helped me with, works perfectly... $query = mysql_query("SELECT * FROM Clients WHERE ClientID = '$_GET[clientid]'"); $arr1 = mysql_fetch_assoc($query); $theStrippedBusinessPhoneNo = stripPhone($_POST['ClientBusinessNum']); $theStrippedHomePhoneNo = stripPhone($_POST['ClientHomeNum']); $theStrippedMobilePhoneNo = stripPhone($_POST['ClientMobileNum']); $theStrippedFaxPhoneNo = stripPhone($_POST['ClientFaxNum']); $theStrippedSSN = stripSSN($_POST['ClientSSN']); $ClientDOBComplete = $_POST['ClientDOBYear'].'-'.$_POST['ClientDOBMonth'].'-'.$_POST['ClientDOBDay']; $query = mysql_query("UPDATE Clients SET ClientFirstName = '$_POST[ClientFirstName]', ClientMiddleName = '$_POST[ClientMiddleName]', ClientLastName = '$_POST[ClientLastName]', ClientMaidenName = '$_POST[ClientMaidenName]', ClientBusinessNum = '$theStrippedBusinessPhoneNo', ClientBusinessExt = '$_POST[ClientBusinessExt]', ClientHomeNum = '$theStrippedHomePhoneNo', ClientMobileNum = '$theStrippedMobilePhoneNo', ClientFaxNum = '$theStrippedFaxPhoneNo', ClientEmail = '$_POST[ClientEmail]', ClientAddress = '$_POST[ClientAddress]', ClientCity = '$_POST[ClientCity]', ClientState = '$_POST[ClientState]', ClientZipCode = '$_POST[ClientZipCode]', ClientSSN = '$theStrippedSSN', ClientDOB = '$ClientDOBComplete', ClientTaxIDNum = '$_POST[ClientTaxIDNum]', ClientEmployer = '$_POST[ClientEmployer]', ClientOccupation = '$_POST[ClientOccupation]', ClientNotes = '$_POST[ClientNotes]' WHERE ClientID = '$_GET[clientid]'"); $results = mysql_query($query); $query = mysql_query("SELECT * FROM Clients WHERE ClientID = '$_GET[clientid]'"); $arr2 = mysql_fetch_assoc($query); $before = array_diff($arr1, $arr2); $after = array_diff($arr2, $arr1); $log_text = ''; foreach($before as $k => $v) { $log_text .= "$k was changed from {$before[$k]} to {$after[$k]},"; } mysql_query("INSERT INTO AccessLogs VALUES ('','$_SESSION[userID]','',NOW(),'$log_text','$_SERVER[REMOTE_ADDR]')");
  21. Hi, I am trying to insert an entry into an access log when someone views a record, but I can not, for the life of me, understand why it will not work... Here's my code... $query = mysql_query("SELECT * FROM Clients WHERE ClientID = '$_GET[clientid]'"); while ($row = mysql_fetch_assoc($query)) { $log_text = ''; $log_text = 'Client '.$row['ClientID'].' - '.$row['ClientFirstName'].' '.$row['ClientLastName'].'\'s information was accessed from the database.'; mysql_query("INSERT INTO AccessLogs VALUES ('','$_SESSION[userID]','',NOW(),'$log_text','$_SERVER[REMOTE_ADDR]')");
×
×
  • 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.