Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,883 members, 7,802,853 topics. Date: Friday, 19 April 2024 at 11:17 PM

Serious Error On My PHP Line Code - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Serious Error On My PHP Line Code (822 Views)

How To Improve My Php Skills / My Php Diary / How Do I Install Php, My Sql To Kit Start My Php Programming Lesson. (2) (3) (4)

(1) (Reply) (Go Down)

Serious Error On My PHP Line Code by keleobasi(m): 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(m): 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)

Mobile Apps Testing Online Training AND Placement Assistance IN USA / Oracle Launches Capacity-building Programme To Close IT Skills Gap In Africa / Gurus In The House, I Need Ur Help

(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. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.