Click here to Skip to main content
15,442,472 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Manually redirect to error.php & send 404 in HTTP header? Pin
Luc Pattyn16-Dec-10 11:11
sitebuilderLuc Pattyn16-Dec-10 11:11 
GeneralRe: Manually redirect to error.php & send 404 in HTTP header? Pin
User 741604616-Dec-10 11:15
MemberUser 741604616-Dec-10 11:15 
GeneralRe: Manually redirect to error.php & send 404 in HTTP header? Pin
User 741604616-Dec-10 12:15
MemberUser 741604616-Dec-10 12:15 
QuestionWeb Services, WSDL and SOAP Pin
Dills100215-Dec-10 1:23
MemberDills100215-Dec-10 1:23 
QuestionLive update of data? Pin
MacRaider413-Dec-10 6:37
MemberMacRaider413-Dec-10 6:37 
AnswerRe: Live update of data? Pin
cjoki13-Dec-10 11:39
Membercjoki13-Dec-10 11:39 
Questionmultiple tables Pin
MacRaider48-Dec-10 2:18
MemberMacRaider48-Dec-10 2:18 
AnswerRe: multiple tables [modified] Pin
cjoki8-Dec-10 9:59
Membercjoki8-Dec-10 9:59 
I'm not sure you code was displayed correctly or not but it looks close to how I would do it.

<?php
// this is very basic and I am not doing a lot of checks.
// I also split my real files up and rarely place this all in one file, but this is just for show anyways.

$dbh = mysql_connect("","",""); //<-- fill in your connection strings...
mysql_select_db(""); //<-- database_name_here

$sql = "select name, phone1 from contacts"; // <-- sample sql
$rst - mysql_query($sql) or die(mysql(error());
if(mysql_num_rows($rst)>0)
{
   $i=0;
   echo "<table class='contact_list'>\n";
   echo "<tr><th>NAME</th><th>PHONE #</th></tr>\n";
   while($row = mysql_fetch_assoc($rst))
   {
      $bgcolor = "#fff;";
      if($i%2) $bgcolor = "#ddf;";
      echo "<tr style='background-color:".$bgcolor."'><td>".$row['name']."</td><td>".$row['phone1']."</td></tr>";
   }
   echo "</table>\n";
}
else
{
   echo "<p class='notice'>No records founds.</p>\n";
}
?>


modified on Wednesday, December 8, 2010 4:06 PM

GeneralRe: multiple tables Pin
MacRaider48-Dec-10 12:53
MemberMacRaider48-Dec-10 12:53 
GeneralRe: multiple tables Pin
cjoki9-Dec-10 4:57
Membercjoki9-Dec-10 4:57 
GeneralRe: multiple tables Pin
MacRaider49-Dec-10 5:18
MemberMacRaider49-Dec-10 5:18 
QuestionChanging the content of a div tag help required Pin
djhankypark6-Dec-10 2:25
Memberdjhankypark6-Dec-10 2:25 
AnswerRe: Changing the content of a div tag help required Pin
cjoki6-Dec-10 4:25
Membercjoki6-Dec-10 4:25 
AnswerRe: Changing the content of a div tag help required Pin
Yvan Rodrigues12-Dec-10 13:45
professionalYvan Rodrigues12-Dec-10 13:45 
QuestionHow to make a binary tree structure in php Pin
amanarora3-Dec-10 18:43
Memberamanarora3-Dec-10 18:43 
AnswerRe: How to make a binary tree structure in php Pin
Dr.Walt Fair, PE12-Dec-10 12:31
professionalDr.Walt Fair, PE12-Dec-10 12:31 
GeneralRe: How to make a binary tree structure in php Pin
amanarora12-Dec-10 20:28
Memberamanarora12-Dec-10 20:28 
QuestionNot able to debug my application Pin
PeriyasamyRamachandran3-Dec-10 3:37
MemberPeriyasamyRamachandran3-Dec-10 3:37 
QuestionNot able to log in - Fatal error [modified] Pin
PeriyasamyRamachandran2-Dec-10 22:25
MemberPeriyasamyRamachandran2-Dec-10 22:25 
QuestionUsing Perl to automate the software installation build process Pin
Blair Symes2-Dec-10 6:34
MemberBlair Symes2-Dec-10 6:34 
Questionbreadcrumbs Pin
AndyInUK29-Nov-10 23:21
MemberAndyInUK29-Nov-10 23:21 
AnswerRe: breadcrumbs Pin
cjoki30-Nov-10 6:26
Membercjoki30-Nov-10 6:26 
GeneralRe: breadcrumbs Pin
AndyInUK1-Dec-10 5:48
MemberAndyInUK1-Dec-10 5:48 
GeneralRe: breadcrumbs Pin
Luc Pattyn1-Dec-10 6:15
sitebuilderLuc Pattyn1-Dec-10 6:15 
GeneralRe: breadcrumbs [modified] Pin
cjoki2-Dec-10 6:29
Membercjoki2-Dec-10 6:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.