Jump to content

mickeymouse

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by mickeymouse

  1. OK. Found my problem. It was the asterisk "*" which I had after the word DELETE. I thought I needed the "*" to signify delete all if more than one with the same criteria. Thank you.
  2. $query = "DELETE * FROM names WHERE `Ref` = '$ref' "; `Ref` is field 0 in my Database and I have an item whose `Ref` is "0001" and my $ref = "0001". But my item is not getting deleted. The $AffectedRows = -1 There are no error messages. What is wrong with my $query statement? Tks
  3. My list of items are multi-words, eg., New York. "New York" is displayed but when selected only the first word is sent, in this case "New". How can I get all the words sent? (without altering my list) <select name="name"> <option value=$Row[1]>$Row[1]</option>
  4. I want to do an image file upload. I copied the code from W3S but get errors: 1- Notice: Undefined index: fileToUpload in C:\xampp\htdocs\Family Tree\FT_UploadFile.php on line 35 2- Notice: Undefined index: fileToUpload in C:\xampp\htdocs\Family Tree\FT_UploadFile.php on line 55 (Strangely, I don't get the same error on lines 40, 55, 70 and 71 even if there is reference to "fileToUpload") 3- Sorry, only JPG, JPEG, PNG & GIF files are allowed.Sorry, your file was not uploaded. The file I'm trying to upload is definitely a "jpg" file as shown when I print the file name that was POSTed for uploading, i.e., C:\Users\Michael\Documents\PHOTOS\EASTER.jpg . Perhaps this is only due to the previous problem. The code in question is: $target_dir = "C:/xampp/htdocs/acconts/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); <---------- line 35 $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); <---------- line 40 if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file \"$target_file\" already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { <---------- line 55 echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "JPG" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "JPEG" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { <---------- line 70 echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; <---------- line 71 } else { echo "Sorry, there was an error uploading your file."; } } Thank you.
  5. OK. I got around the problem with the following code. $Child = mysql_fetch_row($Results); $SavedName[$childcnt] = $Child[1]; $SavedSex[$childcnt] = $Child[2];} print("$SavedName[$childcnt], $SavedSex[$childcnt]<br>"); (The print actually occurs later on in my code as it has to fit into a form after some other printing). Many thanks for your help.
  6. I must put double quotes or printing doesn't work. e.g. Print(ABC<br>) gives me error: unexpected < I am trying to print the 1st item in the array $Child[$childcnt] I am not trying to print $childcnt. $childcnt is indeed a number. It is the nth child and it is used to define which $Child array of the many I could have and as created by the earlier code: $Child[$childcnt] = mysql_fetch_row($Results); I expect to end up with Array $Child[1] containing an Array of child info followed by Array $Child[2] containing an Array of child 2 info, and so on. Then I'm trying to print the info from each array.
  7. Sorry I didn't want to bother you with all the code (now below) and sorry I didn't explain the problem properly. My problem is not with the logic but with the syntax. What happens is I get Parse error: syntax error, unexpected '[', expecting ']' If I don't have a solution to this, then I can try it as you suggest - just push results to the end. But I would prefer to have a solution to my syntax problem. Tks. $childcnt=1; $childdisp=11; $childtotal = 0; while($childcnt<10) {if($Row[$childdisp]<>"") {//================= GET CHILD ========================================= $query = "SELECT * FROM names WHERE `Ref`='$Row[$childdisp]' "; $Results = mysql_query($query, $link) or die ('Error = '. mysql_error()); $AffectedRows = mysql_affected_rows($link); if($AffectedRows < 1) {$Child[$childcnt[1]]=="$Row[$childdisp] Not in the Database."; $Child[$childcnt[2]]=="B";} else {$Child[$childcnt] = mysql_fetch_row($Results); print("$Child[$childcnt[1]] - $Child[$childcnt[2]]");} <-------SYNTAX PROBLEM???? $childcnt = $childcnt + 1; $childdisp = $childdisp + 1; $childtotal = $childtotal + 1;} else {$childcnt = 10;} }
  8. After a query which is iterative depending on a variable count (like $childcnt between 1 & 10), I place the data into an array $Cild[$childcnt] But then I can't access the data within each array, Is my code not correct? $Child[$childcnt] = mysql_fetch_row($Results); print("$Child[$childcnt[1]] - $Child[$childcnt[2]]"); Tks
  9. I have this function code:function myadmin(){location.href=\"HA_AdminChoices.php\";return false;window.open(location.href); return false;} and I have this code to call the function:if ($auth=="a") {myadmin();} But I get this error message:Fatal error: Call to undefined function myadmin() Don't I have the correct way of calling a function? ThanksMickey
  10. Beautiful!Many thanksMickey
  11. Tried it but doesn't work.Is this what you meant?<input readonly size=\"10\" style=\"white-space:nowrap;color:maroon;text-align:left\" value=\"Date\"><input readonly size=\"33\" style=\"white-space:nowrap;color:maroon;text-align:left\" value=\"Description\"><input readonly size=\"10\" style=\"white-space:nowrap;color:maroon;text-align:right\" value=\"Amount\"> <input readonly size=\"15\" style=\"white-space:nowrap;color:maroon;text-align:left\" value=\"From Account\"><input readonly size=\"15\" style=\"white-space:nowrap;color:maroon;text-align:left\" value=\"To Account\">
  12. W3Schools says "If the width attribute is not set, a table takes up the space it needs to display the table data. Problem: I have no width attribute but the width displayed is only a bit more than the screen width and it takes 3 rows to display the data instead of displaying all in one row. I do not have a CSS defining the width. If I define the width in the table tag as width="5000", my data iscorrectly displayed in one row. But I don't want to use this methodbecause the length of my row is variable from one user to another.
×
×
  • Create New...