Need Assistance Out of Date PHP Code

yep I changed that and now the warning has gone, no more warnings for header2.php.

index lines 22 to 34 which includes the remaining errors so far

<?php // Queries All Products where they are Featured or on Special $result = mysqli_query("SELECT * FROM products WHERE SpecFeat = 'YES' ") or trigger_error (mysqli_error()); //echo 'Displaying Results
'; //print_r(mysql_fetch_assoc($result)); //echo '
Results Displayed'; //exit; while ($row=mysqli_fetch_assoc($result)) { require ('tablelogincheck.php'); } ?>

AGAIN… The query(), fetch_assoc() and ALL mysqli functions need to be pointed to the $con as the first parm. Minor change but, the “improved” version of mysql (the i stands for improved), needs to point to the connection in each use.

NOTE: This improvement lets you use two databases at the same time in your application.
You just create two connections and use the correct one for whatever is needed…

So, I have adjusted the code now there is an error (not mine)

Warning : require_once(HTML/Common.php): failed to open stream: No such file or directory in C:\xampp\php\pear\Table.php on line 68

Fatal error : require_once(): Failed opening required ‘HTML/Common.php’ (include_path=‘C:\xampp\php\PEAR’) in C:\xampp\php\pear\Table.php on line 68

It is in a file not associated with my site, I did not create it)

It obviously points to a file/ folder and file that is not included in the XAMPP package

I am in the pear site but it is not allowing me to download the package(s) and there is no folder HTML Folder the require is pointing to:

require_once ‘HTML/Common.php’;
require_once ‘HTML/Table/Storage.php’;

I can see the "files in the Pear Site but not able to get them

Okay, this one depends on your layout of your system. It looks like you have stored your files in an odd place. Normally, you use the c:\xampp\htdocs\yoursitename to store your website in. You would create a name for the top or root folder that matches your website name. So, if this is for a Super-Store website, you might name the folder superstore. So, then all your files would be saved in the standard htdocs and under that file. So, c:\xampp\htdocs\superstore, which would be a folder you would create and place all of your websties files in it. If you have sub-folders such as “inc” or “includes” for included sub-files, those sub-folders go under or inside the superstore folder.

Now, if you have older code and it contains something you did not right, you can add // to the beginning of the line to comment it out. If it was for school back in 2012, it might be something that your code used and needs. PEAR is an extension of PHP and is used for many reasons.

So, my guess is that you need to use that pear file for displaying data in a table format. I have seen this somewhere a long time ago. So, you need to point your system to include the PEAR as an included PHP file. The command is something like this: include_path = “c\xampp\php\PEAR”;
But, first you need to see if PEAR is under the c\xampp\php\ Folder and if so, add the include_path.
If not, search your xampp folder and find where PEAR is and adjust the include_path to point at it. And, this line would be needed near or at the top of your file that needs the Table.php file… ( Before the include for it! )

I feel like you almost have this done already! Good for you! I am leaving in an hour, but, will check back in on you when I get home tonight. So, pat yourself on the back, Keith!

Yeah and all thanks to you which I appreciate very much. I just did a check on my files index.php and header2.php and cannot find even the word PEAR, pear, Pear anywhere in the code. and it is 0252 in the morning here, so I may have to pull the pin very shortly…

No, not in a file. You need to go into the files under c:\xampp\php and look for a FOLDER named pear.
Once you find that, you can add the include_path line at the top of any files that look for the Table.php file.
Where are you, if you do not mind? I am in VT, in the US and it is 1PM Saturday afternoon here.
Talk to you once you get back up!

I am in Queensland Australia, just gone 3am Sunday Morning here

Oh, nice ! I have helped several people from your area! I would love to visit there one day!
Well, get some sleep! I will check in on your later…

Ok, and thanks again so much for your help, guidance and assistance I really do appreciate it.

No problem! That is why we are on this site!

Just one point, on line 68 it says “require_once ‘HTML/Common.php’ ;” My limited code experience says it is pointing to a file called Common.php which is in a folder called HTML, there is no folder, that said, I did find a file called Common in the PEAR Folder.

Well, I will quickly explain INCLUDES. Most of the time they are external files that you have created or that have been added from a library. In PHP there are a ton of libraries that assist with things such as reading or writing to Excel files, PDF files and other things like that. Table.php and Common.php sound like they might have been used from PEAR, but, I am not sure. Hard to guess without seeing some of your code.

Now, with that said, you can change the require_once to pint at the other one in the PEAR folder and see if it works or not. Or, just comment it out for now. Using // at the beginning of the require_one line. That would dummy it out and then see if other errors appear. So, if that file is really needed, you will see other errors pop up if routines in that file are needed. Most likely they will be undefined-function errors or similar. I think you can just dummy them out for this first test.

Yes I did point both of them the where the respected files are, but then I got error after error Where I saw one error I quoted that out, then a new one quoted that out, did the same for about 10 times but kept getting more and more… I ended up undoing all the changes I made in the Table.PHP file. I will make a copy of it and rename the original, then go back through and make all the changes (wont wreck the original) It is referring to Tables, well yes my original design used Tables as I could not get the products to display in Divs etc (I assume it is going to tables as it has detected Tables in the pages… or I may be way off the mark… I am asking myself Why now… Why did I open this can of worms… Bed Time

Ha! Programming puzzles are just that! We will help you solve it all.

I suggest at some point you show us some of your code. Tomorrow once you get back up. Get some rest!

Hey Keith,

Also did Cert IV Web technologies due to the company I was working for wanting someone with web abilities to maintain a website etc.

Did mine in 2015 and yes the PHP being taught is completely out of date. Think they were using version 5.

So to clarify, the older approach to connecting to MySQL is outdated and simply don’t go there.

You have two options

mysqli - mainly aimed at procedural style of coding.

pdo - aimed at OOP as the database is pretty much treated as an object. pdo also has the advantage of connecting to multiple dbs, so if that is a requirement.

There’s a learning curve for both approaches, but nothing a couple of tutorials won’t resolve.

Strangely the only problem I ran into upgrading from a php5 site to 7 was something to do with arrays, can’t quite remember the issue.

Good luck.

Hi This site plays up a bit, quite often I try to log in, and I keep getting an error saying “You can’t Log In as KeithAus from that IP Address” I have tried to contact admin about this, but there have been no replies, it appears that I have to wait 24 hours after logging in/logging Out to actually be able to log back in again… Pain in the…

Anyway, I have been looking at the problems, In the "Table.php: file, I was getting error after error, and I just commented out all the errors, but, there are no “active” actions that have not been commented out, and while the basic page does open in full now, there are no items displayed at all but there are no errors either.

As for the code, I was going to ask if you would like me to zip the file and send it to you? If not I can just post a page or two here. WHEN it lets me log back in that is.

It is close to 11pm here so I wont be here for a lot longer, have a 4:30 start in the morning, I might just stay logged in if it lets me.

I leave mine logged in all the time. We have had several people having trouble logging in. I also tried to contact the owner, but, he has not responded to me either as yet. It all started happening after Microsoft did they big update. But, several people are using phones to access the site. So, I think it is something to do with the site’s server.

As far as zipping it up, if you do, send it in a private message. But, you should handle each error and fix them up one by one. If I do it for you, you will not learn anything. So, perhaps you should leave the table.php in place and just post the first error here. Copy it from the code showing the bad line and a few lines before and after the line throwing the error. Click on the QUOTE or PREFORMATTED tabs above the typing area and paste the code between them. You can look at the preview on the right to see how they will look once posted. And, get some sleep! I will check in later in my day to see what you posted. How’s the weather there, down-under! Ha!

Hi, the weather is ok here in Brisbane, clouding over, but we do need more rain as our combined Dam levels are at only 55%, so yeah a lot more rain needed. Unfortunately, we get rainfall but it is after the catchment areas, which is not good for long term.

Ok so I went back to the original “Table.php” File. First “Error/ Warning” is:

Warning: require_once(HTML/Common.php): failed to open stream: No such file or directory in C:\xampp\php\pear\Table.php on line 68

Fatal error: require_once(): Failed opening required ‘HTML/Common.php’ (include_path=‘C:\xampp\php\PEAR’) in C:\xampp\php\pear\Table.php on line 68

Ther is no Folder Called HTML, so no “Common.php” file. There are other “Common.php” files, BUT they are all different, so that is of no help. There is also a reference to a file on line 69 in Table.php to HTML/Table/Storage.php, which would also display an error. There is only one “Storage.php” file, but wether it is the right one, I cannot say.

Sponsor our Newsletter | Privacy Policy | Terms of Service