doBibleInfo.php

Parent Previous Next

<?php


// echo "Hi from Php for TeXworks Latex  $argv[1] $argv[2]"


 $column_to_Search      = $argv[3];

 $list_items = explode(",",$argv[2]);

 $column_to_return      = $argv[1];

 

 $imbetween = "\\begin{center}\n\\rule{0.71\\columnwidth}{1pt}\n\\end{center}\n";


$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');

 $build = "";



 // Performing SQL queries

 

 foreach ( $list_items as $this_item)

{

 $build .=  "\\noindent\\textbf{" .  $this_item . "} -- ";

 

 $query = "SELECT " . trim($column_to_return). " FROM bibles where " . trim($column_to_Search)  . " = '"

            . trim($this_item) . "' " ;

                       

//        echo $query . "\n\n";                

 // $query = 'SELECT CONCAT(cite_key, \',  \', title) FROM entries order by ' . $orderBy ;


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



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

 {

 

  foreach ($line as $col_value)

   {

      $build .=  trim($col_value) .  $imbetween;  

    }  

 }


// Free resultset

  mysql_free_result($result);


}

// Closing connection

mysql_close($link);


$build = trim($build); // clean off last linefeed else blank option in dropdown results

echo $build;


// Thanks to  http://www.tech-recipes.com/rx/2059/mysql_use_concat_to_include_text_in_select_results/



?>



Created with the Personal Edition of HelpNDoc: Easily create HTML Help documents