Re: Hello and help
| From: | Richard Baskett | Date: | Fri, 03 Jan 2003 21:33:37 +0000 |
| Subject: | Re: Hello and help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130158@lists.php.net to get a copy of this message | ||
Use this instead:
<?php
$Host="localhost";
$User="us34992a";
$Password="*****";
$DBname="db34992a";
$Tablename="calendar";
$Link=mysql_pconnect($Host, $User, $Password)
or die ("YOu suck1");
$db=mysql_select_db($DBname, $Link)
or die ("ISUCKEGGS");
$result=mysql_query("SELECT * from calendar", $Link)
or die ("YOu suck3");
print("<table width=\"53%\" border=\"0\" cellpadding=\"0\"
cellspacing=\"0\">\n");
print ("<tr>\n");
print ("<td background=\"topbig.gif\">\n");
print ("<div align=\"center\"><font face=\"Arial, Helvetica,
sans-serif\"><b><font
color=\"#FFFFFF\">Calender</font></b></font></div>
</td>
</tr>\n");
print ("<tr bgcolor=\"#009ACE\">\n");
print("<td>{$result['meeting_name']}</td>\n") or die ("you
suck");
mysql_close ($Link);
?>
So basically make sure you escape your double quotes within your print
statements, plus you should use single quotes in your associative array.
Cheers!
Rick
"Sir my concern is not whether God is on our side. My great concern is to be
on God's side." - Abraham Lincoln
> From: "Todd Barr" <tbarr@geo-imaging.com>
> Date: Fri, 3 Jan 2003 16:32:08 -0800
> To: <php-general@lists.php.net>
> Subject: [PHP] Hello and help
>
> I am a PHP newbie, and I am having difficulty in getting my records to display
>
> here is my code
>
> <?php
> $Host="localhost";
> $User="us34992a";
> $Password="*****";
> $DBname="db34992a";
> $Tablename="calendar";
> $Link=mysql_pconnect($Host, $User, $Password)
> or die ("YOu suck1");
> $db=mysql_select_db($DBname, $Link)
> or die ("ISUCKEGGS");
> $result=mysql_query("SELECT * from calendar", $Link)
> or die ("YOu suck3");
> print("<table width="53%" border="0" cellpadding="0"
> cellspacing="0">\n");
> print ("<tr>\n");
> print ("<td background="topbig.gif">\n");
> print ("<div align="center"><font face="Arial, Helvetica,
> sans-serif"><b><font
> color="#FFFFFF">Calender</font></b></font></div>
> </td>
> </tr>\n");
> print ("<tr bgcolor="#009ACE">\n");
> print("<td>$result[meeting_name]</td>\n")or die ("you suck");
> mysql_close ($Link);
> ?>
>
> any help?
>