mysql_fetch_array() brings back an associative array by default.
It's not "$result[0]" but instead "$results["column_name"]"
Also, you can use is_set() on subarrays.
if ((isset($result["col1"])) &&
(is_array($result["col1"])) &&
(sizeof($result["col1"])))
{
// do stuff here
}
Remember that the above SEQUENCE is important. If you deviate from it,
you may get "unknown variable" or other error messages.
-Szii
----- Original Message -----
From: "Prodoc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 22, 2002 2:38 PM
Subject: Re: [PHP-DB] Re: Retrieve information from mutiple tables
>
> >
> > Does the simple case (without specifying MainID) work?
> >
> > And are you pretty sure that $row['MainID'] actually holds a valid value?
> >
> > Have you tried printing the whole of the above query to see what it actually
> > contains?
> >
> > If it looks valid try copy-paste that query into the mysql command-line to
> > see what comes up.
> >
>
> I tried the query in the mysql command-line and this does give me the
> data I want to get.
> $row['MainID'] does hold a valid value is this should mean I doing
> something wrong at displaying the values, doesn't it?
> I just started using mysql and php it will probebly be a stupid mistake
> I made.
> I get one or more values back using the mysql command-line and I'm
> trying to display the values one by one by using $result =
> mysql_fetch_row (&res) (I tried mysql_fetch_array as well) but it only
> displays one result by using $result[0].
> $result[1] or higher doesn't give me anything, what could be the problem?
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php