Jump to content

F1Fan

Members
  • Posts

    1,182
  • Joined

  • Last visited

Everything posted by F1Fan

  1. Here's more info: http://us.php.net/manual/en/function.session-start.php
  2. You should create a session.
  3. Or you could use a javascript function with an event listener that either submits the page how you want it to when they hit enter, or make it not submit at all when they hit enter. You could even add an alert that tells them to click either update or delete.
  4. OK, I need to be sure I understand what you're trying to do. This is what I do understand (I think): You have 3 basic pages. We'll call the first one "main.php." Main.php has two iframes, containing "left.php" and "right.php." When someone clicks a link in right.php, you want it to target left.php? And you already have names and targets set up and it's not working?
  5. Why wouldn't you just use tables? It would be infinitely easier and you'd have more options.
  6. Yes, however, if you wanted to change the $time variable to something other than the current time, the $nextmonth var would be one more month from $time, making it a little more flexible.
  7. If you do it that way, you have the potential to end up with a month 13, which it will probably understand as 1 plus one year, but maybe not. Your best bet is to use strtotime.
  8. Use the strtotime() function like this: $time = time(); $nmonth = strtotime($time." +1 Month");
  9. I'm thinking you may have a vertical-align: center; somewhere in your CSS.
  10. Maybe it wants a space in between the ) and VALUES "...dwg)VALUES ('..." $query = mysql_query("INSERT INTO part_pricing (date_entered, price, machine, partnum, partname, description, cnc, dwg) ". "VALUES ('$date', '$price', '$machine', '$partnum', '$partname', '$description', '$cnc', '$dwg')") or die(mysql_error());
  11. It looks like you're including this phptuts.php file. Maybe you're including it more than once?
  12. Try getting rid of the old <center> tags and just add align="center" to the <table> tag. Maybe that old <center> tag is taking all spaces literally like the pre tag.
  13. Arg, my bad. <?php $affdetails =" SELECT id, ref2, ref3, ref4 FROM affiliates WHERE aff_id = '$aff'"; $result = mysql_query($affdetails) or die(mysql_error()); $row = mysql_fetch_assoc($result); $aff1 = $row['ref2']; echo $aff1; ?>
  14. Did you try adding quotes around the values?
  15. You're missing the fetch function: $affdetails =" SELECT id, ref2, ref3, ref4 FROM affiliates WHERE aff_id = '$aff'"; mysql_query($affdetails) or die(mysql_error()); $result = mysql_fetch_assoc($affdetails); $aff1 = $result['ref2']; echo $aff1;
  16. You are using parenthesis rather than brackets. Try this: $aff1 = $affdetails['ref2'];
  17. I see a few things. First, your first div has class="style6 style6 style6", when it should be class="style6". Also, it's using static widths, rather than percentages. Like the first table in that first div has a width="935". If you do this, it will be that number of pixels, regardless of the user's screen size and resolution. Try changing all those width values to appropriate percentages.
  18. As long as your web server and databases are set up to handle that load, it shouldn't be a problem.
  19. OK, I'll try and simplify this as much as possible. <form method="post"> <?php if (!isset($_POST['id'])){ ?> Enter your ID here: <input type="text" size="5" name="id"><input type="submit" value="Submit"> <?php } elseif (!isset($_POST['name'])){ $result = mysql_query("SELECT name FROM users WHERE id = {$_POST['id']}"); $row = mysql_fetch_array($result); ?> <input type="hidden" name="id" value="<?=$_POST['id?>"> Change your name: <input type="text" size="25" name="name" value="<?=$row[0]?>"><input type="submit" value="Submit"> <?php } else{ $result = mysql_query("UPDATE users SET name = '{$_POST['name']}' WHERE id = {$_POST['id']}") if ($result) echo "Name saved"; else echo "Problem saving"; } ?> </form> Hope that helps.
  20. Hmm... Try it on just the $_SERVER variable, or try print_r($_SERVER); and see if there's anything of use to you.
  21. OK. Now add this inside the second loop: <?php echo "<pre>"; print_r($page); echo "</pre>"; ?>
  22. A DB table, or tables would be the way to go. I would suggest you use your lowest common denominator. If you wanted total hits, monthly hits, and daily hits, then your lowest is days. So, make your table with two columns; date and count. Then every time someone hits it, you can increment that day. Like this: $query = "SELECT \"count\" FROM hit_counter WHERE \"date\" = '".date('Y-m-d')."'"; // If you get a result, do an update. Otherwise do an insert // then you can do one of three selects: // for one day $query = "SELECT \"count\" FROM hit_counter WHERE \"date\" = '$date'"; // for one month $query = "SELECT SUM(\"count\") FROM hit_counter WHERE \"date\" BETWEEN '$startdate' AND '$enddate'"; // total $query = "SELECT SUM(\"count\") FROM hit_counter";
  23. W3Schools is my fav. Start here: http://www.w3schools.com/php/php_mysql_intro.asp
  24. I would suggest storing all the images in a directory with that month, like your "/0908/" directory that you mentioned. Then your code could just use the date to determine which folder it's in. Then you never loose track of where something is, and your folders will never get too big.
  25. Sorry, I also forgot this (as wildteen pointed out): mysql_select_db() You need to tell it which database it needs to use, even if there's only one. Like this: <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); $hostname = ""; $database = ""; $username = ""; $password = ""; $petitionscript = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db('dbnamehere',$petitionscript); ?> <? if (isset($_POST['submit'])) { $subject = $_POST['subject']; $message = $_POST['message']; $query="SELECT mail FROM signature"; $result = mysql_query($query,$petitionscript) or die (mysql_error()); $num = mysql_num_rows($result); $i=0; while ($i < $num) { $email=mysql_result($result,$i,"email"); mail($email, $subject, $message, "From:>\nX-Mailer: PHP/" . phpversion()); echo "Email sent to: " . $email . "<br />"; $i++; } } ?> <br /> <form name="email" action="<?=$_SERVER['email.php']?>" method="post"> Subject <br /> <input name="subject" type="text" size="50" id="subject"><br /><br /> Message <br /> <textarea name="message" cols="50" rows="10" id="message"></textarea> <br /><br /> <input type="submit" name="submit" value="Email!"> </body> </html>
×
×
  • 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.