getBibleAbrsCommaList.php

Parent Previous Next

<?php

//$orderBy = 'title';

//$orderBy = 'cite_key';


//  $orderBy = $argv[1];


// Connecting, selecting database

$link = mysql_connect('localhost', 'root', '')

  or die('Could not connect: ' . mysql_error());

// echo 'Connected successfully';


mysql_set_charset('utf8');


mysql_select_db('bible_ref') or die('Could not select database');


// Performing SQL query

// $query = 'SELECT cite_key title FROM entries';


$query = "SELECT Abbr FROM bibles order by Abbr" ; //. $orderBy ;


$result = mysql_query($query) or die('Query failed: ' . mysql_error());


$build = "";


while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

 

  foreach ($line as $col_value) {

     $build .=  trim($col_value) .  ",";  

  }  

}


// Free resultset

mysql_free_result($result);

// Closing connection

mysql_close($link);


 $build = trim(substr($build, 0, -1)); // clean off last comma and cleanse

echo $build;


?>


Created with the Personal Edition of HelpNDoc: Easily create iPhone documentation