Advertisement

07.09.2008 at 09:26PM PDT, ID: 23552657
[x]
Attachment Details

Displaying field in mysql database

Asked by starview in PHP Installation, PHP and Databases, MySQL

I have a php script here that workd fine, but it prints out all the field in the table.

I would like to have it only print out one of the fields.

The fields in the table are;
mainpage_id
mainpage_content
mainpage_insert_date
owner_id

I would like it to only display the contents of the field "mainpage_content"

I am not sure how to change the following script to do this.

<html><head></head>
<body>
<?php
$db_host = "xxxxxx";
$db_user = "xxxxxx";
$db_pwd = "xxxxxx";
$db_name = "xxxxxx";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
$result = mysql_query("SELECT * FROM mainpage_table WHERE mainpage_insert_date > DATE_SUB(NOW(),INTERVAL 4 DAY)ORDER BY mainpage_insert_date") or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
</body>
</html>
Start Free Trial
[+][-]07.09.2008 at 09:34PM PDT, ID: 21970427

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Installation, PHP and Databases, MySQL
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.09.2008 at 09:57PM PDT, ID: 21970521

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.10.2008 at 10:50AM PDT, ID: 21975873

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.10.2008 at 10:54AM PDT, ID: 21975902

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.10.2008 at 06:47PM PDT, ID: 21979312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.11.2008 at 07:25AM PDT, ID: 21982655

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.11.2008 at 01:19PM PDT, ID: 21985719

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628