Re: Fwd: Q

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try using 0 and 1 in place of 'id' and 'email', depending on the order
in which these are presented in the database.  If the database presents
id first, then id is 0.  If email is first, email is 0.  You should
really read the PHP manuals on mysql_fetch_array() before assuming a
particular behavior from that function.  By default, mysql_fetch_array
gives you an array with *numerical* indices, not indices with field
names.

If you're having trouble outputting an array, you can (and should)
always do a print_r($array) to see what the index and actual values are.
-- 
Peter Ellis - pellis@xxxxxxxxxxxxxxx
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/

On Sun, 2004-08-22 at 11:10 -0400, Remember14a@xxxxxxx wrote:
> Dear friends,
>  
> Php query modification, guidance, please.not mysql alteration table.So
> that Query displays data in tabular form with "Onclick" link to web
> site in another column of table.
>  
> Guidance, please.
> Email message/mailbox attachment
> On Sun, 2004-08-22 at 11:10 -0400, Remember14a@xxxxxxx wrote:
> > Remember14a@xxxxxxx wrote:
> > > Dear Friends,
> > > 
> > > Data in the table is displayed by php query.
> > > 
> > > .Say column A, in which name of company will be stored.
> > > 
> > > Now i want to add another column B to table in which web addresse will be 
> > > stored against each name in Column B.and same should be displayed in an html  
> > > table, when seen in browser with link to each web address in table.
> > > 
> > > The php query I am using now, is posted below.
> > > What additional code should I add so that data in column A in table1 is 
> > > displayed in tabular form, with a link "on click", to web address in column B.
> > > 
> > > Guidance to further Query, please.
> > > 
> > > ------------------------
> > > Present Query
> > > --------------------
> > > 
> > > <?php
> > > // open the connection
> > > $conn = mysql_connect("localhost", "", "");
> > > 
> > > // pick the database to use
> > > mysql_select_db("b",$conn);
> > > 
> > > // create the SQL statement
> > > $sql = "SELECT * FROM subscribers ORDER BY email";
> > > 
> > > // execute the SQL statement
> > > $result = mysql_query($sql, $conn) or die(mysql_error());
> > > 
> > > //go through each row in the result set and display data
> > > while ($newArray = mysql_fetch_array($result)) {
> > >         // give a name to the fields
> > >     $id  = $newArray['id'];
> > >     $email = $newArray['email'];
> > >     //echo the results onscreen between ""can also //type$id is and &email is
> > >     echo " $email <br>";
> > > }
> > > ?><center>

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux