Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,241 members, 7,818,825 topics. Date: Monday, 06 May 2024 at 06:01 AM

Help In Debugging PHP Code - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Help In Debugging PHP Code (773 Views)

Help In Putting The Google Adsense code Before The Final Review / Got A New Wordpress Site,need Help In Setting It Up Pls / New Debugging Method Finds 23 Undetected Security Flaws In Popular Web Apps (2) (3) (4)

(1) (Reply) (Go Down)

Help In Debugging PHP Code by Olaryinkah: 6:52pm On Aug 03, 2015
Please guys help me in debugging this am just an amarteur

Re: Help In Debugging PHP Code by Pierocash(m): 7:28pm On Aug 03, 2015
off to night vigil.wil help when I return
Re: Help In Debugging PHP Code by olyivy(f): 7:42pm On Aug 03, 2015
you missed the closing brace "}" just put it at the last line of your code and phew!
Re: Help In Debugging PHP Code by onyengbu: 7:57pm On Aug 03, 2015
True, adding the closing brace will solve it but then, your error message will not come out as you desired.
If you just add the brace without doing anything else, on db connection failure, you will get error message you intended for incomplete form filling.
So, Where you have the message "you have to complete the form" replace with something like " database connection failure",
then after your current last brace you can now put your complete form message. Then add the missing brace.
Re: Help In Debugging PHP Code by Olaryinkah: 11:35pm On Aug 03, 2015
Thanks guys,u re d best I will try all u ve said n get back to u
Re: Help In Debugging PHP Code by micodon(m): 1:34am On Aug 04, 2015
Olaryinkah:
Please guys help me in debugging this am just an amarteur

1. Your mysql_connect parameters should be strings unless they are CONSTANTS which i higly doubt.

So change mysql_connect(localhost, root, DBPASS) to mysql_connect("localhost", "root", "DBPASS"wink;

2. your mysql_select_db first param should be a string unless you are using a CONSTANT. so shange mysql_select_db(powercrib, $connection) to mysql_select_db("powercrib", $connection);


3. From PHP 5.5 mysql has been deprecated. It is in your best interest to use mysqli or PDO.

An advice.....Learn coding using notepad or notepad++. Dreamweaver may not make you a good coder.
Re: Help In Debugging PHP Code by onyengbu: 7:21am On Aug 04, 2015
micodon:

An advice.....Learn coding using notepad or notepad++. Dreamweaver may not make you a good coder.
But those are not even Dreamweaver generated codes. As long as he is not letting Dreamweaver generate codes for him, I don't really see how notepad will make him a better coder.
Re: Help In Debugging PHP Code by micodon(m): 4:17pm On Aug 04, 2015
onyengbu:

But those are not even Dreamweaver generated codes. As long as he is not letting Dreamweaver generate codes for him, I don't really see how notepad will make him a better coder.

well, I thought the codes were generated.

Second, someone who's using Dreamweaver to learn has to have great self control to prevent him from generating codes via Dreamweaver. With notepad, there's no temptation of that sort.

With the good old notepad, you learn some good coding practice like indentation and others
Re: Help In Debugging PHP Code by DualCore1: 5:06pm On Aug 04, 2015
onyengbu:

But those are not even Dreamweaver generated codes. As long as he is not letting Dreamweaver generate codes for him, I don't really see how notepad will make him a better coder.
There is a reason why the army first breaks an individual to barebones before rebuilding to spec.

Learning with a plain text editor like Notepad++ will give the learner the opportunity to write every line of code himself without the enticement of function usage hinting and code completion.

There is a reason good driving schools still using manual transmissions to teach. We know a driver who learnt with an auto transmission can't just jump into a manual transmission and move. However the manual transmission learner can jump into an auto transmission and move.

Well the bottom line is learn with the basic tools and as one develops his skills, use whatever IDE works best for you. Nothing personal but inside me I don't think I will take any developer seriously if his "home" IDE is Dreamweaver (Yes I know there is the "code view" but I don't see what a web developer should be doing with an IDE that has "design view" and other useless features... not to mention the terrible code DW generates).

Professionally I worked with Notepad++ for about 4-5 years before switching to PHPStorm. I don't see myself leaving PHPStorm anytime soon. For quick fixes my default application is still Notepad++.
Re: Help In Debugging PHP Code by micodon(m): 5:41pm On Aug 04, 2015
DualCore1:

There is a reason why the army first breaks an individual to barebones before rebuilding to spec.

Learning with a plain text editor like Notepad++ will give the learner the opportunity to write every line of code himself without the enticement of function usage hinting and code completion.

There is a reason good driving schools still using manual transmissions to teach. We know a driver who learnt with an auto transmission can't just jump into a manual transmission and move. However the manual transmission learner can jump into an auto transmission and move.

Well the bottom line is learn with the basic tools and as one develops his skills, use whatever IDE works best for you. Nothing personal but inside me I don't think I will take any developer seriously if his "home" IDE is Dreamweaver (Yes I know there is the "code view" but I don't see what a web developer should be doing with an IDE that has "design view" and other useless features... not to mention the terrible code DW generates).

Professionally I worked with Notepad++ for about 4-5 years before switching to PHPStorm. I don't see myself leaving PHPStorm anytime soon. For quick fixes my default application is still Notepad++.

Lovely.

I too won't take a Dev seriously if his IDE of choice is DW
Re: Help In Debugging PHP Code by Olaryinkah: 6:52pm On Aug 04, 2015
Thanks very much guys..I know u want something good for me...I will switch to notepad++ though I dnt use DV I use sublime ...I just use DV to edit that

(1) (Reply)

10 Reasons Nigerians Are Not Reading Your Blog Posts / MUST SEE: How To Place 2 Divs Side By Side In CSS / A Web Designer Needed

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.