₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,331,219 members, 8,449,195 topics. Date: Tuesday, 21 July 2026 at 12:30 PM

Toggle theme

Serious Error On My PHP Line Code - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingSerious Error On My PHP Line Code (916 Views)

1 Reply (Go Down)

Serious Error On My PHP Line Code by keleobasi(op): 8:42am On Dec 18, 2013
I have the code below in my php work but it shows error.


<?php

$main_path = "C:\xampp\htdocs\keleobasi\";
$include_path = "C:\xampp\htdocs\keleobasi\includes\";

?>


the trailing backslash (\) before the closing double quote ("wink makes the PHP see it that the string is not yet finished. Someone help
Re: Serious Error On My PHP Line Code by adewasco2k(m): 10:12am On Dec 18, 2013
keleobasi: I have the code below in my php work but it shows error.


<?php

$main_path = "C:\xampp\htdocs\keleobasi\";
$include_path = "C:\xampp\htdocs\keleobasi\includes\";

?>


the trailing backslash (\) before the closing double quote ("wink makes the PHP see it that the string is not yet finished. Someone help
Simple: use double backslash, backslash in php denotes and escape character.

So you will use a backslash to escape the backslash. grin
Re: Serious Error On My PHP Line Code by keleobasi(op): 12:41pm On Dec 18, 2013
Thank you Adewasco2k
Re: Serious Error On My PHP Line Code by Nobody: 6:10pm On Dec 18, 2013
why not use relative paths?

e.g

<?php

$main_path = "";
$include_path = "includes/";

?>
it will give you less headache when you want to use a web host
Re: Serious Error On My PHP Line Code by adewasco2k(m): 7:23pm On Dec 18, 2013
webdezzi: why not use relative paths?

e.g


it will give you less headache when you want to use a web host
That is not even his problem, backslash just before the single or double will escape the quote there by giving error, so he needs a fix to that even if he applies your way, which truly will help him when uploading to a host
Re: Serious Error On My PHP Line Code by Eesyboi: 12:59pm On Dec 19, 2013
webdezzi: why not use relative paths?

e.g


it will give you less headache when you want to use a web host
Thats right, using relative paths is a good coding practise.

And he should use the slash / instead of back slash \?
Re: Serious Error On My PHP Line Code by Najwal: 8:23pm On Dec 29, 2013
adewasco2k: That is not even his problem, backslash just before the single or double will escape the quote there by giving error, so he needs a fix to that even if he applies your way, which truly will help him when uploading to a host
.
Re: Serious Error On My PHP Line Code by hobyner(m): 11:22pm On Jan 06, 2014
webdezzi: why not use relative paths?

e.g


it will give you less headache when you want to use a web host
Abi? Less stress. Y write all dat long stuff.
1 Reply

How To Improve My Php SkillsMy Php DiaryHow Do I Install Php, My Sql To Kit Start My Php Programming Lesson.234

Help Plsssss!Here Are Top Ways For A Mobile/Web Programmer To Build Passive Income StreamsIs Programming A Dead End Job? What Are Your Thoughts?