View Full Version : Can someone help me with displaying information?

06-21-2006, 04:12 AM
I have a website that is making some sort of a dictionary. Basically what I am doing is having everything display where the letter equals A.
Here is my php code for the function

function display_db_table_dictionary($tablename, $connection,
$header_bool, $table_params)
$word = "Word";
$Def = "Definition";
$firstLetter = "first_letter";
$table = "Dictionary";
$Letter = "A";
//echo ($word);
//$query_string = "SELECT * FROM Dictionary WHERE substring($word, 1, 1) = 'A'";
//$query_string = "select $word, $Def from $table where substring($word, 1,1) = 'A' ";
//$query_string = "select Word, first_letter from Dictionary";
$query_string = "SELECT * FROM table WHERE (name like '$A')";
// $query_string = "SELECT * FROM $table ";
//$query_string .= "WHERE $word LIKE 'A%'";

//$query_string = "select $word $Def from $table where ($firstLetter = 'A')"
//display_db_query($query_string, $connection,
// $header_bool, $table_params);

All of the commented lines are the sql commands that I have tried.

06-21-2006, 04:25 AM
You can use mysql's LEFT function:

Good luck;

06-21-2006, 04:33 AM
Now it says...

$query_string = "SELECT * FROM $table WHERE ($word like 'A%')";