Uhh, I'm already that far. Maybe I didn't explain it precisely. I would like to display the results in the HTML file using echo. Something like
for every result
{
printf( "<td>data1</td><td>data2</td>");
}
It's just that I'm not sure with the code.
DIMA: I'm 99% sure that this can be done, but you'll definetly need to be more specific...it would help if you would provide us with some of your code and point to where you think something is missing...
------------------
Chris Bowyer – chris@mycoding.com
MyCoding.com: Visit for Launch Notification!
DomainMailings.com: Who Says All The Good Ones Are Taken?
MovieForums.com: Talk About Your Favorite Flicks!
Hi,
at icosmoss.com I have separated our projects into "completed" and "pending". I already have made the script loading the data but how do I display the results now?
I'm thinking of the echo tag...
------------------
Matthias Hagemann
Need some source code?
icosmoss.com - The Open Source Community
Your Lord and Master, Foamy
A simple select statement can handle this.
select * from projecttable where type='pending'
Then your record set would only contain the appropriate records.
------------------
Wayne Luke - Sitepoint Forums Administrator
Digital Magician Magazine - MetaQuark Creations (Coming Soon)
sitepoint@digitalmagician.com
[This message has been edited by wluke (edited August 10, 2000).]
Ok, here's the whole code (shortened):
<?php
// connect to the database server
$connection = mysql_connect("localhost", "user", "pass") or die("Ooops! Couldn't make connection.");
// selecting a database in mySQL
$db = mysql_select_db("db", $connection) or die("Ooops! Couldn't select database.");
// request the text of all the info
$sql_result = mysql_query("SELECT author, language, date, title FROM table WHERE status = $status");
// defining var of row
while($row = mysql_fetch_array($sql_result))
{
// define vars
$author = $row["author"];
$language = $row["language"];
$date = $row["date"];
$title = $row["title"];
}
?>
All projects listed below are freely downloadable and ready for any changes. Before sending.......
<BR><BR><BR>
[ this is the place where the result should be shown ]
[ just like http://www.icosmoss.com/pending.shtml ]
I parse the var for $status in the URL before, so it knows what rows to show.
[This message has been edited by DIMA (edited August 10, 2000).]
SitePoint Zealot
// defining var of row
while($row = mysql_fetch_array($sql_result))
{
// define vars
$author = $row["author"];
$language = $row["language"];
$date = $row["date"];
$title = $row["title"];
echo( "<tr><td>" . $title . "</td>" .
"<td>" . $language . "</td>" .
"<td>" . $author . "</td>" .
"<td>" . $date . "</td></tr>");
}
?>
// And Put this stuff up above the database part
All projects listed below are freely downloadable and ready for any changes. Before sending.......
<BR>
<table>
Hope this helps,
Adam
------------------
Visit the Sitepoint Chat!
http://www.sitepoint.com/forums/chat.php3
Hey thanks, it works just fine!
To see the result just go to http://www.icosmoss.com/ and click on pending or completed projects.
One more thing: is it possible to sort the listing by name?
------------------
Matthias Hagemann - matt@icosmoss.com
Need some source code?
icosmoss.com - The Open Source Community
Your Lord and Master, Foamy
Add an "ORDER BY" clause to your SQL statement.
SELECT author, language, date, title FROM table WHERE status = $status ORDER BY title
------------------
Wayne Luke - Sitepoint Forums Administrator
Digital Magician Magazine - MetaQuark Creations (Coming Soon)
sitepoint@digitalmagician.com
Thanks to you all! It works perfectly
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks