Jump to content

Paul-D

Members
  • Posts

    117
  • Joined

  • Last visited

Everything posted by Paul-D

  1. Thanks for that I didn't correct a <?php. PHP 8 is very strickt and takes no prisoners. I w will have to go through the rest of my code with a fine tooth comb. Thanks for your help.
  2. That didn/t work it gave me another error Parse error: syntax error, unexpected token "?" in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/StatementEntry.php on line 113 Probably because the ending bracket was moved away from the ? SELECTED <?php }? >
  3. Well I have done exactly as you sugest but this is still not happy. The problem is around a <select> </select> on lines 111 to 123 Error: Parse error: Unclosed '{' on line 122 in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/StatementEntry.php on line 191. I can not see any issues as there is definatly spaces here. There is .htaccess with the lines php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on phpTest.txt
  4. Well thanks to Barrand. Leaving spaces after <?php and before ?> has made a diffrence. I have never done that before. Is this NEW to PHP8 or has it always supposed to be that way? Love to know!
  5. One question is, if i put an exit; on line 4 why do I not get an ! am here message only?
  6. Error on page is Parse error: Unclosed '{' on line 183 in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/DataInput.php on line 23
  7. As an addition, they changed my .htaccess to php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on
  8. I have had majour problems with my easyspace website. I beleive the servers were not updating over the weekend. I am now told that the reason for the error is on a line that should not be reached. I put a hello world and an exit at the verry top of the code. Can soneone tell me what is wrong with line 183 please [<?php if($MM > '10') {?>] After I spoke to them this morning the page says Parse error: Unclosed '{' on line 183 in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/DataInput.php on line 236 But there is no line 236. Test.txt
  9. Well thanks for all that. I thought ther was a problem with that function but it worked fine under PHP 5.4 for some strange reason. THings are looking up now. Thanks also to kicken. I have only used <?php at the beginning of a file but stand correctedd now.
  10. Thanks for all your help. I have managed to isolate the function with the problem. The problem is I can't figure a way out of it. I have a database table of futuristic entries into an look ahead statment. What I want to do is display an online bank statment where the start date is given to a function and I want the querie to create a data set from tthat date to six weeks in advance. Can someone help me out with this query. What is strange here is this all worked fine for tebn years untill my provider updated the server from PHP 5.4 to PHP8. So the SQL will probably need to change. function GetAllData($StartDate) { $pdo = connectDB(); $sqlAllData = "SELECT * FROM Bank_Data WHERE EntryDate > :StartDate AND EntryDate <= DATE_ADD(:StartDate, INTERVAL 6 WEEK) ORDER BY EntryDate ASC, Output"; $stmt = $pdo->prepare($sqlAllData); $stmt->execute(['StartDate' => $StartDate]); return $stmt; } Error Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/secure/SecureFunctionsBankPDO.php:39 Stack trace: #0 /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/secure/SecureFunctionsBankPDO.php(39): PDOStatement->execute() #1 /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/Statement.php(104): GetAllData() #2 {main} thrown in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/secure/SecureFunctionsBankPDO.php on line 39
  11. Well that is new to me. I have only used <?php at the start of a page and under php 5.4 it worked fine for over 10 years. Maybe this is more strickt in PHP 8. It did work fine for over 10 years. FACT. I will go through all my files tomorrow and let you know the outcome.
  12. My screenshot only shows a web page with problems. it dosn't show code. all the pages start withy <?php. I HAVE CHECKED. I know I am getting old and I haven’t touched this stuff for ten years or more but this section of my website, a virtual bank statement from today and into the 6 week future, to give me an idea of my spending limits, is very important to me. Statement.php.txt
  13. I know I am getting old and I haven’t touched this stuff for ten years or more but this section of my website, a virtual bank statement from today and into the 6 week future, to give me an idea of my spending limits, is very important to me.
  14. As you can see from the screen print of my web page. The trapping errors is not working. I need to find out why the error is. I have shown my ConnectDB() code and the function FetAllData(). I have directly tried the SQL on the database and it is fine. It is the same SQL I used before in mMySQL which worked for years. The SQL is fine. My question is, is there a problem with the PDO database conection code? Can someone check the PDO code please. Checked out Ubinto download and got... What you will need: A Windows 10 or Windows 11 physical or virtual machine with all the updates installed. Out of my league vertual Windows.
  15. AND FINALY. To make things worse. I have to work this on a webhousting company because I am using a Windows computer and can not set the whole thing up with loacal host, PDO driven database and PHP 8. Life would be great if I could.
  16. <div style="width:150px;height:4px;padding:10px;text-align:right;float:left;clear:both;"><a style="color:#ae22e2;" href="DataInput.php">* <?=$StartDate?></a> </div> <div style="width:70px;height:4px;padding:10px;text-align:right;float:left;"> </div> <div style="width:70px;height:4px;padding:10px;text-align:right;float:left;"> </div> <div style="width:70px;height:4px;padding:10px;text-align:right;float:left;">&pound;<?=number_format( $Value,2,'.',',')?> </div> <div style="width:100px;height:4px;padding:10px;float:left;"> </div> <div style="width:250px;height:4px;padding:10px;float:left;">Brought forward </div> <? $stmt = GetAllData($Date); echo $stmt; // Is there an error? exit; while($row = $stmt->fetch()) { $stamp = strtotime($row['EntryDate']); $ViewDate = date('D d-M-Y' ,$stamp); $CurDate = date('D d-M-Y' ,time()); ]] etc ... // The function // function GetAllData($StartDate) { $pdo = connectDB(); $sqlAllData = "SELECT * FROM Bank_Data WHERE EntryDate > :StartDate AND EntryDate <= DATE_ADD(:StartDate, INTERVAL 6 WEEK) ORDER BY EntryDate ASC, Output"; if ($_SESSION['CounterValue'] == 'Total') { $sqlAllData = "SELECT * FROM Bank_Data ORDER BY EntryDate ASC, Output"; } if ($_SESSION['CounterValue'] == 'Database') { $sqlAllData = "SELECT * FROM Bank_Data ORDER BY EntryDate ASC, Output"; } $stmt = $pdo->prepare($sqlAllData); $stmt->execute(['StartDate' => $StartDate]); return $stmt; }
  17. I have done this. All the files have error-Reporting(ALL) and ini-set('display_errors', '1') <?php error_reporting(E_ALL); ini_set('display_errors', '1'); date_default_timezone_set('Europe/London'); define ('HOSTNAME1', 'mysql09.iomart.com'); define ('USERNAME1', 'User'); define ('PASSWORD1', 'password'); define ('DATABASE1', 'databes'); function connectDB() { static $pdo = null; if($pdo === null) { $host = HOSTNAME1; $user = USERNAME1; $pass = PASSWORD1; $MyDB = DATABASE1; $pdo = new PDO("mysql:host=$host; dbname=$MyDB; charset=UTF8", $user, $pass, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]); } return $pdo; }
  18. My website has worked for 15 years under mysql noew under php 8 I have to convert queries to PDO. My question is do these functions return any form of error code that can be examined. I have suaght help on this in this forum before but as I am new to PDO I need advice on trapping any PDO errors. $stmt = $pdo->prepare($sqlAllData); $stmt->execute(['StartDate' => $StartDate]); '' and in the main page $stmt = GetAllData($Date); while($row = $stmt->fetch()) { } TIA
  19. all the PHP code together in one file. I can't see anything that is wrong with the PDO code here. It seems like the call to $stmt = GetAllData($Date); FAILS but it should not fail. It didn't under PHP 5.4 My-PDO connections .txt
  20. I changed the information in my uploaded file but I beleive the folder is secured. and has been for a long time now. SecureFunctions/
  21. mac_gyver pointed out that I am not using <?php in the statment.php I have corrected this as for opening the connection every time. I was told to do this . . . connections.txt And the web page has changed now because of <?php added Still does not like fetch() that is the bug in the system think. I was helped 6 months ago when trying to change the site to PDO. I am not mixing mysql with PDO here and it did work under PHP 5.4. I think it my webserver host has done something here. Connection.txt
  22. I am not ussing a secure type server if that is what you mean. I could not see any diffrences between your updated code on the first two functions except you removed the // error number and placed the opening brace at the end of the first line. It still does not work with that code. As for "secure/SecurePDO.php file that contains your PDO connection". I do have a file with all the database connection setiings in a seperate file which has worked under PHP 5.4. This functioned fine. So something dosn't work under PHP8. As for the mix of code mysql. I beleive all that has now been replaced with correct PDO codeing.
  23. Here is the PHP info on the website server. Don't understand that part. Can you check that this part is atleast correct please. As for Ensure that the `connectDB()` function is correctly implemented and returns a PDO instance. If there's an issue with this function, it might affect the query execution.;' This worked fine under PHP 5.4 so it is calling the database correctly and supplying the data.
  24. Okay. I have been out of programming a long time and was told that the website I was going to be upgraded to PHP8. I converted all my database queries to PDO. I assumed that the rest of the PHP would be fine. It apears not. It seems the problem is with my PDO which worked fine under PHP 5.4. I know this is not going to be a topic you would not want to get into but if I had some pointers at this level could work the rest out. Seems it does not like ... $pdo = connectDB(); $stmt = $pdo->query("SELECT * FROM Bank_config"); $row = $stmt->fetch(); return $row; This was actualy working under PHP 5.4 SecureFunctionsBank.txt Statement.txt
  25. Hi. My host is upgraiding the server from PHP 5.4.45 to PHP 8. I am running Mysql MYSQL 5.5.62. Is this compatable or will I have to work with new drivers. I will be moving from MYSQL 5.5.62 to 5.7.4-43 mysql_query() and mysql_query(). I was told to upgrade this to PDO and have changed my coding to $pdo = connectDB(); $pdo->query(). I have just been told that it is going to be upgraded to MySQLi so my newly created PDO will not work. Will my old mysql_query() still be valid or will I need to do imidate changes. I do not get a say in things like MySQL and PDO.
×
×
  • 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.