Jump to content

socalnate

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by socalnate

  1. The format is correct but it echos "4-2-2008" when todays date is "2-10-2008". Help very much appreciated...stumped. I updated my server time and rebooted my apache server but to no avail... Today's Date: <?php //----------------------------- $now = time(); $num = date("w"); if ($num == 0) { $sub = 6; } else { $sub = ($num-1); } $WeekMon = mktime(0, 0, 0, date("m", $now) , date("d", $now)-$sub, date("Y", $now)); //monday week begin calculation $todayh = getdate($WeekMon); //monday week begin reconvert $d = $todayh[mday]; $m = $todayh[mon]; $y = $todayh[year]; echo "$d-$m-$y"; //getdate converted day ?>
  2. I've been attempting to understand classes and objects. There is one bit of information I'm confused on and that is when you can use $this. From what I've read I'm assuming you can ONLY use $this to reference variables within the CLASS (brackets) only. You cannot create an object and then try to call (or echo) a variable within that class using $this. EX: <?php $myobject = new foo_object(); echo $this->foo ; ?> Correct way is this: <?php $myobject = new foo_object(); echo $myobject->foo ?> I am right? ???
  3. Can anyone please tell me how to create a log file for Apache using linux for the Google Adsense program? I'm supposed to have a log file but I can't find the access.log file (even though there should be one by default). I run a dynamic website so I want my links to be generated from a log file. Nathan ???
  4. Yeah I don't understand why I have to include FROM eg_gameplay_history in my query. I guess it has something to do with the COUNT?
  5. Thanks, This query worked! The only issue I'm having is that it is very slow...3.0645 seconds! :'( Any suggestions? SELECT eg_titles. * , eg_genres.id, eg_gameplay_history.title_id, eg_gameplay_history.played, eg_gameplay_history.play_date, COUNT( eg_gameplay_history.played ) AS 'title_count'FROM eg_titles, eg_gameplay_history LEFT JOIN eg_genres ON eg_titles.id = eg_genres.id WHERE eg_genres.genre = 'action' AND eg_titles.id = eg_gameplay_history.title_id AND eg_gameplay_history.play_date BETWEEN DATE_SUB( CURDATE( ) , INTERVAL 3 DAY ) AND CURDATE( ) GROUP BY eg_gameplay_history.title_id ORDER BY title_count DESC LIMIT 10
  6. I can't figure out why SQL is telling me why this table doesn't exist when it clearly DOES exist in my database. Any ideas? Something wrong with my SQL query? Nathan __________ Error SQL query: Documentation SELECT eg_titles. * , eg_genres.id, eg_gameplay_history.title_id, eg_gameplay_history.played, eg_gameplay_history.play_date, COUNT( eg_gameplay_history.played ) AS 'title_count' FROM eg_titles LEFT JOIN eg_genres ON eg_titles.id = eg_genres.title_id WHERE eg_genres.genre = 'action' AND eg_titles.id = eg_gameplay_history.title_id AND eg_gameplay_history.play_date BETWEEN DATE_SUB( CURDATE( ) , INTERVAL 3 DAY ) AND CURDATE( ) GROUP BY eg_gameplay_history.title_id ORDER BY title_count DESC LIMIT 10 MySQL said: Documentation #1109 - Unknown table 'eg_gameplay_history' in field list
  7. Been trying to figure out an array issue. For some reason when I echo $key it's echoing "Array". I want it to return the key (in this case adventure). Help appreciated... <?php $action_percent = 1; $adventure_percent = 20; $genre_array = array( 'action'=>$action_percent, 'adventure'=>$adventure_percent ); echo $genre_array['action']; echo $genre_array['adventure']; $max_value = max($genre_array); echo $max_value; $key = array_keys($genre_array, max($genre_array)); echo $key; ?>
  8. Can I set variables to arrays? (Problem is I'm requesting input boxes that have a different name value so I can't just $_REQUEST it to an array...I need to set the array to specific variables.) Not sure how to do it...can't find any examples. $genre_array = array( 'Genre 1' => $var1, 'Genre 2' => $var2, 'Genre 3' => $var3 );
  9. What? I turned off safe mode in my php.ini config but it says it is still turned on because it is giving me a safe mode error. Even more bizzare is that it is writing to another directory just fine when if, in theory, safe mode was actually turned on it would be restricting all files. I'm totally baffled on this one... ???
  10. Figured out the problem: Yeah when you write you can't use HTTP headers. You have to use the local file path name: EG /var/www/vhosts/yourdomain.com/httpdocs/folder/$new_file_name UGH now I'm getting a SAFE MODE error. I seriously hate SAFE MODE. lol
  11. Here's the error: Warning: move_uploaded_file(http://www.mydomain.com/titles/a5eeb0c9dea193531ddd45d2d2e0acc9_welcome.swf) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/vhosts/mydomain.com/subdomains/dev/httpdocs/upload.php on line 541
  12. How do you move files from a sub domain to a main domain? It gives me an error and won't allow it even though I've changed my folder permission to 777. move_uploaded_file($_FILES["file_name"]["tmp_name"],"http://www.maindomain.com/titles/$new_file_name" ); It works though if I make the paths relative to the sub-domain. (I've got a development server dev.maindomain.com and all the paths are relative...so I made all absolute paths to write to but it doesn't work. I'm linuxed based..) Nathan
  13. BLAH! I found it.... HERE...wow it is so easy to miss a detail like this. '$credit6type')")
  14. I'm debugging a script and I get this SQL error but I'm scratching my head wondering why I'm getting it? Anybody know? I'm just not seeing it... :-\ 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 '' at line 1AT 781 credit_insert query. $title_name = mysql_real_escape_string($title_name); $credit1 = mysql_real_escape_string($credit1); $credit1type = mysql_real_escape_string($credit1type); $credit2 = mysql_real_escape_string($credit2); $credit2type = mysql_real_escape_string($credit2type); $credit3 = mysql_real_escape_string($credit3); $credit3type = mysql_real_escape_string($credit3type); $credit4 = mysql_real_escape_string($credit4); $credit4type = mysql_real_escape_string($credit4type); $credit5 = mysql_real_escape_string($credit5); $credit5type = mysql_real_escape_string($credit5type); $credit6 = mysql_real_escape_string($credit6); $credit6type = mysql_real_escape_string($credit6type); $credit_insert = mysql_query("INSERT INTO eg_credits(`id`, `title_name`, `user_name`, `ip`, `credit1`, `credit1type`, `credit2`,`credit2type`, `credit3`, `credit3type`, `credit4`, `credit4type`, `credit5`, `credit5type`, `credit6`, `credit6type`) VALUES ('$id', '$title_name', '$submit_user_name', '$ip', '$credit1', '$credit1type', '$credit2', '$credit2type', '$credit3', '$credit3type', '$credit4', '$credit4type', '$credit5', '$credit5type', '$credit6', '$credit6type'") or die (mysql_error() . "AT 781 credit_insert query.");
  15. You know how MYSQL automatically generates an incremental id using auto_increment? My goal is to copy the id that was just generated from a PHP SQL insert in table 1, to table 2, and table 3. AKA I'm copying the ID value to different tables generated from one. The reason being is that there aren't the same number of rows in table 2 or table 3 so my ID value will be off. However, for some reason my table 2 and table 3 aren't getting the $id value...Anybody know what I'm doing wrong? ??? $id_query = mysql_query("SELECT title_name FROM eg_titles WHERE title_name = '$title_name'", $login); if (!$id_query) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } $row = mysql_fetch_row($id_query); [color=red]$id [/color]= $row[0]; $description_insert = mysql_query("INSERT INTO eg_descriptions(`id`, `cr_datetime`, `title_name`, `description`) VALUES ('[color=red]$id[/color]', NOW(), '$title_name', '$description')") or die (mysql_error() . " - AT 777 description_insert query."); FYI, I'm using LEFT JOINS
  16. Javascript noobie here. So I'm working on form validation and I'm simply adding up all the input data and checking to make sure it equals 100. If it doesn't, then I want a popup and to focus on the div container enclosing the inputs "Sum Must Equal 100 Percent." How do I get the popup to popup? Here's what I got so far: <script type='text/javascript'> // Make quick references to our fields var action_percent = document.getElementById('action_percent'); var adventure_percent = document.getElementById('adventure_percent'); var animation_percent = document.getElementById('animation_percent'); var arcade_percent = document.getElementById('arcade_percent'); var fighting_percent = document.getElementById('fighting_percent'); var casino_percent = document.getElementById('casino_percent'); var defense_percent = document.getElementById('defense_percent'); var board_percent = document.getElementById('board_percent'); var sports_percent = document.getElementById('sports_percent'); var puzzle_percent = document.getElementById('puzzle_percent'); var multiplayer_percent = document.getElementById('multiplayer_percent'); var driving_percent = document.getElementById('driving_percent'); var shooter_percent = document.getElementById('shooter_percent'); var classic_percent = document.getElementById('classic_percent'); var gadget_percent = document.getElementById('gadget_percent'); var webcam_percent = document.getElementById('webcam_percent'); // Sum the inputs var total_percent = action_percent + adventure_percent + animation_percent + arcade_percent + fighting_percent + casino_percent + defense_percent + board_percent + sports_percent + puzzle_percent + multiplayer_percent + driving_percent + shooter_percent + classic_percent + gadget_percent + webcam_percent if(total_percent != 100){ }
  17. How do you fetch uploaded files from session variables back into form input where input type="file" ? I understand how to do it with text like so: value="<?php echo $_SESSION['credit6_sess']; ?> How do you do this when type="file" ? I don't want to have to have people upload a file twice if a script encounters a problem with the text but not with the file. Press back in the browser and walla their uploaded file is gone. Make people angry and not want to upload again. Cheers! (FYI I'm NOT posting it via PHP_SELF deal but to another file upload.php)
  18. I run a database that has a significant amount of apostrophe's (') as the ' in cd's. Problem is when I run an SQL query the SQL query is interpreting the apostrophe as part of a statement and it gives me an error. If I remove the apostrophe I don't get an error. Any ideas on how to fix this? I'm going to sleep on it... Nathan "I program, therefore, I am."
  19. My problem was about people uploading different types of images but there's no function that will imagecreatefrom(any supported types). So you have to tell php what KIND of image you have to manipulate BEFORE you crop it. Also, I was confused because 99% of the examples I saw on the Internet that dealt with image cropping didn't show you how to deal with different image types. They only specified imagecreatefromjpeg so I thought that you could only crop an image if the image was jpeg to begin with. If you try to send the function imagecreatefromjpeg a gif file it will output an error because you didn't specify the correct function for that image. Anyway, I they should create by default a function "imagecreatefromany" to auto-detect the type of image. I have no doubt this has confused other people as well. if ($type = "1") { $src = imagecreatefromgif($uploaded_thumb); } elseif ($type = "2") { $src = imagecreatefromjpeg($uploaded_thumb); } elseif ($type = "3"){ $src = imagecreatefrompng($uploaded_thumb); } elseif ($type = "6"){ $src = imagecreatefromwbmp($uploaded_thumb); }
  20. So how do you crop other types of formats using php like for a gif or a png file? Nathan
  21. Yes, forgetting the '$' in $timestamp was the problem. lol
  22. <?php $timestamp = time(); echo "<li>Time Submitted:" . date("m/d/Y",timestamp) . "</li>"; ?> Outputs 12/31/1969. Anybody know how to fix it so it outputs the correct time? Nathan
  23. So I want to validate an entire block of text fields for an application. IE, I want AJAX to look at 16 text field boxes all at once and tell me if anything is in them at all. Is this even possible? Anybody post any links to some examples of this? I've been looking all over... ??? Nathan
  24. Here's an unusual AJAX script I need some help / suggestions on. Go here:http://dev.egamestorm.com/submit.php Notice the "Select a Genre" section with percentages: I need the Select A Genre section to... 1) Give me a warning message if I haven't entered any percentage value into any of the input boxes 2) If in any of the boxes the value x>100%, highlight that box in red with a warning message "Can't be greater than 100%" 3) If in any of the boxes a negative value is entered a warning message appears "Can't enter negative percentages!" 4) If the TOTAL VALUE of every box is greater than 100% give a warning message "Error: Total Percentage is over 100%!" How the heck do I do this? ???
×
×
  • 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.