I am unable to add the LIMIT variable to the following code. I am trying to just display the first record, but when I add “LIMIT 1″ after the .$gid part of the code, I get an error. I have tried every variable. I am also not sure why the ” space period $gid is formatted like it is.
<?php
$sql = "SELECT * FROM `loan_real_types` WHERE fKeyGroup = " . $gid;
$result = mysql_query($sql) or die(mysql_error());
while($results = mysql_fetch_assoc($result)) {
echo "" . $results['name'] . "";
}
?>
Ultimately, I am just trying to display the first record of the table where fkeyGroup is a match.
You probably just forgot to add space before
LIMITwhich would cause an error.