Forum Moderators: coopster
SELECT * FROM my_table WHERE name='octavio' , hoping it would only show that data for that row.... can anyone tell me what im doing wrong or if they understand what i mean
You can limit the number of rows returned with the LIMIT selector, SELECT * FROM my_table WHERE name='octavio' LIMIT 0,1
Be advised that while this will return only one row, it may not be the one row you anticipated. For example, if you wanted the third row for 'octavio' the LIMIT selector isn't the best solution.
However, before I ramble on any more, how about telling us what data you are, or are not, selecting.
try something like this
<?php
$sql = @mysql_query( "
SELECT *
FROM YourTable
WHERE name='octavio'
");//make sure the query worked
if (!$sql ) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
//get the data
$datastuff = mysql_fetch_array($sql);
$name = $datastuff ["name"];
$ID = $datastuff ["ID"];
$morestuff = $datastuff ["morestuff"];
echo "<p>Hey I just grabbed ".$name." with an ID of ".$ID." - from the database!</p>";
?>
Any good?