Reply
PHP and HTML combined
Old 11-09-2004, 12:14 AM PHP and HTML combined
vgking101's Avatar
Average Talker

Posts: 17
Location: Virginia
I am still learning PHP and i was writing some Data Base code. I am copying from a book i am learning from and it uses HTML tags inside PHP. It dosent work when i run it though. is there something im doing wrong?
__________________
If i am here but WE are not, am i here? Dunno.
vgking101 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-09-2004, 12:22 AM
foobar's Avatar
Extreme Talker

Posts: 225
What exactly doesn't work? It would help a lot if you gave us the relevant error messages, posted a snippet of code and a link to to the site (if it's online that is).
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Old 11-09-2004, 12:24 AM
Christopher's Avatar
Iced Cap

Posts: 3,111
Location: Toronto, Ontario
If you are copying code directly from a book and trying to connect to a database, then it likely won't work.

The information in the book (username, password and database name) will not be the same as your own. You should ask your host for these details.
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 11-09-2004, 12:26 AM
vgking101's Avatar
Average Talker

Posts: 17
Location: Virginia
heheh sorry about that. ERROR: Parse error: parse error, unexpected '<', expecting '}' the rest just says the path and what line its on. Im just wondering if you can use HTML in the PHP section of code.
__________________
If i am here but WE are not, am i here? Dunno.
vgking101 is offline
Reply With Quote
View Public Profile
 
Old 11-09-2004, 01:00 AM
lothop's Avatar
Ultra Talker

Posts: 269
Try this..

Replace the '<' with a '}'


If not, please post the section of code and the link it corresponds with.
__________________
Websites Created;
warscope.com
ratepayers.org.nz
lothop is offline
Reply With Quote
View Public Profile
 
Old 11-09-2004, 01:40 AM
Christopher's Avatar
Iced Cap

Posts: 3,111
Location: Toronto, Ontario
To output HTML, you must break out of PHP, or echo it out.

PHP Code:
<?php

echo "<b>in php</b>";

?>

<b>Out of php</b>
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 11-09-2004, 12:17 PM
compmodder26's Avatar
Experienced Talker

Posts: 44
What you may have seen is called a here document. It has the syntax of

PHP Code:
echo <<<HEREDOCUMENT
<html>
<head>
</head>
<body>
.......
</body>
</html>
HEREDOCUMENT; 
That is used to make the output appear exactly as you make it in the here document as opposed to having to add a new line character to each line like this:

PHP Code:
echo "<html>\n
<head>\n
</head>\n
<body>\n
...\n
</body>\n
</html>\n 
It has other uses, but I won't get into all of them.
__________________
Buy Cool Univeristy of Kentucky Merchandise at
KentuckyGear.com
compmodder26 is offline
Reply With Quote
View Public Profile Visit compmodder26's homepage!
 
Old 11-09-2004, 10:27 PM
vgking101's Avatar
Average Talker

Posts: 17
Location: Virginia
echoing the stuff out worked
__________________
If i am here but WE are not, am i here? Dunno.
vgking101 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP and HTML combined
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15045 seconds with 12 queries