Jump to content
xisto Community
scab_dog

How Do You Find Lines In Php? The Title says it all :P

Recommended Posts

Hello Xisto Members,

I would really like to know how to find lines in PHP, Like my forums. Like when it says Error on Line 345. How do you find the line. I sat there one day pressing the down arrow counting the line, but there should be a simpler way of doing i. Can anybody help.

Well I know what i said above dosent make sence, but it will do, it is hard to explain. :ph34r:

From,
.::DAMAN::.

Share this post


Link to post
Share on other sites

Find the troubled file, copy its content to Notepad, go to View - Status Bar, then scroll down, click on a random line, look at the status bar, and it will tell you what line your cursor is on. Keep doing that until you get what you want.I'm also moving this to another forum since it doesn't belong here.

Share this post


Link to post
Share on other sites

Most programs have line numbers running down the left hand side, such as the one I use, PHP Designer 2005.

If you don't want to download one of these programs then use Notepad. As snlildude87 said, you can look at the status bar, but a quicker way is to press Ctrl + G and type in the line number you want.

Share this post


Link to post
Share on other sites

you need to have a text editor that displays line number, I used EditPlus 2, its cool since it support PHP codes which mean different colors on globals, variables and functions, anyway, what you do is to have the same exact copy of the php in your website and the editor so when errors appear, you could simply locate it in the editor and then correct the error in the editor then upload the corrected file to your server. you could either use ftp or simply the upload feature in the filemanager.

Share this post


Link to post
Share on other sites

I think we get the picture. A text editor which displays line numbers. Got it the first few times.

Anyway, daman, an easy way (in my opinion, anyway) is to use PHP to find the troublesome block of code, something to the effect of:

<pre><?php$code = file('script.php');for( $i=error_line-5;$i<(error_line+5);$i++ ) {   $output[] = isset($code[$i]) ? $code[$i] : '';}echo implode("\n",$code);?>

It's often easier to spot errors if you can crop the section of code causing the problem.

Share this post


Link to post
Share on other sites

You must be kidding dude!, I'm almost sure you must have Macromedia MX installed in your PC, right? if it is true, then just use Dreamweaver, that's it! there is no complication at all. But if you want to try something new, then use http://www.nvu.com/

Cheers!! :ph34r:

Share this post


Link to post
Share on other sites

You must be kidding dude!, I'm almost sure you must have Macromedia MX installed in your PC, right? if it is true, then just use Dreamweaver, that's it! there is no complication at all. But if you want to try something new, then use http://www.nvu.com/

 

Cheers!! :D

189897[/snapback]

for lots of reason i am not using Wysiwyg editor. So im stuck in text based editor like notepad :ph34r:

Share this post


Link to post
Share on other sites

Thanks Every1,I find it much Easier to do what rvalkass said, I just copied all the PHP code into notepad, then Ctrl+G, this seemed to work for me. Thanks everyone.PS. Soory about the wrong forum snildude, dont worry i'll take a note in my mind now!!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.