Jump to content

matto

Members
  • Posts

    230
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

matto's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I think you mis-understand how sessions work. Every new visitor to this script has the session variable $_SESSION['Guest'] set to 1 and $_SESSION['Guest'] is only incremented when the script is executed by someone who has already visited the page <?php session_start(); if(isset($_SESSION['Guest'])) { //This code is only executed by the already visited guest $_SESSION['Guest']=$_SESSION['Guest']+1; echo "\$_SESSION['Guest'] now equals: " . $_SESSION['Guest']; } else { //every new visitor gets the $_SESSION['Guest'] = 1 $_SESSION['Guest']=1; } ?> It would be better to keep track of the number of guests using a database...
  2. Only have the code execute when the submit button on the form is pressed. eg: if(isset($_POST['submit')) { //start executing code.... }
  3. Could also be worth placing the following file on your host provider to see what the configuration looks like - just look for the session details <?php phpinfo(); ?>
  4. If all you are trying to do is transfer the data into an array for later use you could do this using something like the following: $tablenames = array(); $search = $newarray[$i]; $sql_s = "SHOW TABLES FROM db WHERE Tables_in_db LIKE '%$search%' AND Tables_in_db LIKE '%k%'"; $result_s = mysql_query($sql_s) or die ("Error in query: $query. ".mysql_error()); while ($row_s = mysql_fetch_row($result_s)) { //collect all the table names into an array for later use $tablenames[] = $row_s[0]; } //now loop through table names for($i=0;$tablenames[$i];$i++) { echo $tablenames[$i] . "<br>"; }
  5. You can find more info here: http://nz2.php.net/manual/en/features.file-upload.post-method.php
  6. You could fix this by altering the insert statement to define the fields that are going to have data populated into. Example: $sql = "insert into tablename (field1, field2) values('$field1','$field2')"; @mysql_query($sql) or die(mysql_error());
  7. It is possible to store the contents of the file in the database, but what you need to do is Upload the file to the server Read the contents of the file from $_FILES['form_data']['tmp_name'] Store the contents of the file in a variable and use this in your sql insert statement. I would also change this line: $data = addslashes(fread($_FILES['form_data']['tmp_name'], "r")), filesize($form_data)); to something like this: $data = base64_encode(file_get_contents($_FILES['form_data']['tmp_name'])); Just remember to use base64_decode when pulling the file data from the database.
  8. Can I suggest you change this line @mysql_query("INSERT INTO ".addslashes($blackorwhite)."list VALUES ('".addslashes($bwurl,$bwreason)."')"); to this: @mysql_query("INSERT INTO ".addslashes($blackorwhite)."list VALUES ('".addslashes($bwurl,$bwreason)."')") or die(mysql_error()); Once you have done this try to do the action that does the insert and see what error message you get.
  9. I think you will find you need to read from the $_FILES['form_data']['tmp_name'] varibale rather than the $form_data variable. fopen($form_data, "r")
  10. I think premiso meant post the code you are using when you are doing the insert. could also be useful to see the table definition: mysql>desc tablename
  11. you don't need a new <form> each time. <form methos="post" action="somepage.php"> <?php while($row = $db->fetch_array()) { //generate each checkbox and whatever else... } ?> </form>
  12. I agree with awpti - Don't do it. One thing to consider: What happens if the email sent to a customer is forwarded onto someone who is a non customer....
  13. why are you generating a new <form> for each record in your while loop ?
  14. you may need to suppress the normal error from the mysql_query function using @mysql_query($sql) $query = @mysql_query($sql) or header("Location: error.php");
×
×
  • 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.