Jump to content

kenoli

Members
  • Content Count

    53
  • Joined

  • Last visited

Community Reputation

0 Neutral

About kenoli

  • Rank
    Regular Member

Profile Information

  • Gender
    Not Telling
  1. OMG, it's just too early in the morning. Thanks. --Kenoli
  2. I have defined my database connection data as constants in a separate file for security reasons. How can I simply access the data stored in those constants. I have to call the file to get the value of the constants. If I inadvertently call the file twice in a script using an include or require statement, I get an error that I am trying to define the constants again. Can I somehow just call the constants without including the file where they are defined? --Kenoli
  3. I am getting the following error message: Fatal error: Uncaught Error: Array callback must have exactly two elements in /Users/studio/Sites/BannerProject/b-as/tio-new/__classes/person_form_edit_initial.php:14 Stack trace: #0 /Users/studio/Sites/BannerProject/b-as/tio-new/index.php(78): require() #1 {main} thrown in /Users/studio/Sites/BannerProject/b-as/tio-new/__classes/person_form_edit_initial.php on line 14 for a line in my code that only has the following code: $person_id = $_SESSION('person_id'); This is a simple array assignment. Where is the "two elements" requireme
  4. Great, thanks. That should do it. I couldn't understand the php.net explanation. --Kenoli
  5. I'm trying to do this with the code below. I get an error because explode thinks I'm just sending it one argument since the string is held by an array element. If I can get the array from the explode function I can insure it into the first and last name fields in my table. Any suggestions? --Kenoli require '__classes/Db.php'; $sql = "SELECT name FROM tbl_persons"; $stmt = $pdo->query($sql); $row = $stmt->fetchall(PDO::FETCH_ASSOC); foreach ($row as $name) { $names = explode($name['name']); }
  6. Actually, I figured it out. Thanks, --Kenoli
  7. I'm not sure how to implement this. When I try, it just pulls out one record and inserts it in the new table. I have 227 rows I want it to do this to. Not sure how to construct a statement to do this. I was doing it with prepared statements using "?" placeholders as above and thought it should work, but it doesn't. I runs, throws no errors but inserts nothing into the table. --Kenoli
  8. Stuck again on simple code. I am trying to insert some fields extracted from one table into another. I'm using code that worked elsewhere. The SQL statement flies, the script runs, the input array is printed back I get an echo back from the end of the script but nothing is added to the table. Even aded an echo print_r in the conditional and I know the data is getting to the execute command. The script follows with a sample of the input array. I have attached am image of the table I am trying to insert the data into. --Kenoli The script: <?php require '__classes/DB.
  9. Thanks. That makes sense. I also changed "select" as I thought that might be a problem and that issue is now gone. I had to fix a couple of other errors that I figured out and it worked! --Kenoli
  10. PS -- This is a sample of the execute array as print_r displays it. It looks right to me: Array ( [0] => Array ( [0] => 1 [1] => FALSE [2] => Carol Lettko [3] => [4] => [5] => TRUE [6] => FALSE [7] => Carol_Lettko-DSC_3022.jpg [8] => Baby Herons/Brickyard [9] => photo [10] => [11] => [12] => ) [1] => Array ( [0] => [1] =>
  11. I'm sorry to be back so soon, but I'm up against another mystery. I'm using the code below to enter a bunch of css data from a spreadsheet into a mysql table. I think the data file is OK. The array created by the script checks out with print_r. (There are many more records than shown. I truncated it to save space.) The problem is that I get this error regarding my sql statement, not the data or anything else: Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your
  12. It works! I guess html doesn't like quotes in array elements. Hooray. Many thanks, I guess we're good to go. Sorry for how long it took. I appreciate your persistence. --Kenoli
  13. PPS -- Actually, I just now got both errors when I ran it with the conditional. The fact that it repeated the error three times as indicated above would indicate that the fatal error didn't occur that time. When I just ran it, it did. The errors returned are inconsistent. Here are the two errors: Warning: Undefined array key "title" in /Users/studio/Sites/BannerProject/b-as/_test_site/__classes/upload_images.php on line 71 (on the conditional line) Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in /Users/studio/Sit
  14. PS -- Regarding the first error, there is an array with the key "title" that has content in the array referred to in the "if" conditional.
  15. I re-typed everything I had copied and pasted having had the same thoughts you had. It did get rid of an earlier issue but it still fails. The errors are described below. I am including my form code below as you requested. I was not sure exactly how to set it up but the way I did gave me a POST array I could work with. I get the following error when I run the script with the conditional as I go it from this discussion. Line 71 is if ($title_elements['title'] != ''). Warning: Undefined array key "title" in /Users/studio/Sites/BannerProject/b-as/_test_site/__classes/upl
×
×
  • 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.