Re: Hello and help
| From: | OrangeHairedBoy | Date: | Sat, 04 Jan 2003 08:33:30 +0000 |
| Subject: | Re: Hello and help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130216@lists.php.net to get a copy of this message | ||
Or to make it easy, here's the line you need:
$info = mysql_fetch_array( $result );
Put that line right after the query. So, here's sample:
$Link=mysql_pconnect($Host, $User, $Password);
$db=mysql_select_db($DBname, $Link);
$query=mysql_query("SELECT * from calendar", $Link);
$result = mysql_fetch_array( $query );
print $result[meeting];
You can also use Objects:
$result = mysql_fetch_object( $query );
print $result->meeting;
If you're getting more than one line, you need to fetch each row. For
example:
$query = mysql_query( "select * from capitals" );
while ( $a_row = mysql_fetch_array( $query ) )
{
print "$a_row[capital] is the capital of $a_row[country]<br>\n";
}
Hope this helps!
Lewis
"Todd Barr" <tbarr@geo-imaging.com> wrote in message
news:00df01c2b388$b6e48930$6e20280a@ff...
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?