...

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



briintex1
06-21-2006, 03: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.

Brandoe85
06-21-2006, 03:25 AM
You can use mysql's LEFT function:
[http://dev.mysql.com/doc/refman/5.0/en/string-functions.html]

Good luck;

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


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum