on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:

>if there a command that will give me the name of the fields
> in the result set?

mysql_field_name() might help... but generally I know what fields I want to
grab, so I don't need this...  I found this answer on http://php.net/mysql.
just as you could :)


> how to I test for a null value?

empty()?  isset()?  if($var == "")?  if($var == "NULL")??  have a look in
the php manual for string functions, and comparison operators


> how do I go from one row to the next

A while loop for the result set, row by row would look something like this,
printing the id, author and date for each row in the table

<?
$sql = "SELECT * FROM tablename WHERE blah blah";
$result = mysql_query($sql);
if($result)
    {
    while($myrow = mysql_fetch_array($result))
        {
        echo $myrow['id'];
        echo $myrow['title'];
        echo $myrow['author'];
        }
    }
?>


> or how do I filter a result set based on a value in a
> column?

rather than filter a result set, write the right query to start with:

SELECT * FROM tablename WHERE colname='value' AND colname2='othervalue'

also check out:

ORDER BY colname 

and

LIMIT

in the mysql manual


> is there a way to sum a specific field?

SELECT SUM(colname) as mysum FROM tablename WHERE type='fiction'



> would appreciate whatever help I can get, and even better if somebody know's
> a step through that goes through all the basic's of database syntaxes in
> php.

It's not PHP that you neccessarily need to read up on.... the real power
comes from the SQL queries you write.  You need to spend time playing around
with code, and then asking us specific questions... needless to say, a hunt
through the manuals first would help, as would a search of the archives :)

This page is a pretty good start for MySQL:
http://www.mysql.com/doc/en/Function_Index.html


Justin French


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to