(SOLVEDV) Re: Problems with displaying results

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

 



Thanks everyone it was the WHILE I just moved the ending bracket and presto
results show in tables...

Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
------------------------------------------------
Twitter?
http://twitter.com/terionmiller
------------------------------------------------
Facebook:
<a href="http://www.facebook.com/people/Terion-Miller/1542024891";
title="Terion Miller's Facebook profile" target=_TOP><img src="
http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
alt="Terion Miller's Facebook profile"></a>
Carl Sagan  - "In order to make an apple pie from scratch, you must first
create the universe."

On Thu, Mar 5, 2009 at 11:25 AM, Lex Braun <lex.braun@xxxxxxxxx> wrote:

>
> On Thu, Mar 5, 2009 at 10:30 AM, Terion Miller <webdev.terion@xxxxxxxxx>wrote:
>
>> Still having problems with getting this script to work, the first part of
>> the query does now work since I used the suggested JOIN, so my results are
>> there and I can echo them but now I can't seem to get them to display
>> neatly
>> somehow:
>>
>> --------------------CODE THUS
>> FAR--------------------------------------------
>>   $query =  "SELECT admin.UserName, admin.AdminID, workorders.WorkOrderID,
>> workorders.CreatedDate, workorders.Location, workorders.WorkOrderName,
>> workorders.FormName, workorders.STATUS, workorders.Notes, workorders.pod
>> FROM admin LEFT JOIN workorders ON (admin.AdminID = workorders.AdminID)
>> WHERE admin.Retail1 = 'yes'
>> ";
>>
>>    $result = mysql_query ($query) ;
>>    //$row = mysql_fetch_array($result);
>>    while ($row = mysql_fetch_row($result)){
>>     $admin_id = $row['AdminID'];
>
>
> mysql_fetch_row() returns a numerical array (
> http://ca2.php.net/manual/en/function.mysql-fetch-row.php), but then you
> are trying to assign $admin_id using an associative array. Thus, you need to
> either return your row as an associative array (
> http://ca2.php.net/manual/en/function.mysql-fetch-assoc.php) or assign
> $admin_id as a numerical array:
>
> Method 1: Use a numerical array
> $result = mysql_query($query);
> while($row = mysql_fetch_row($result)) {
>     $admin_id = $row[1]; // since it's the 2nd item in your SELECT
>     ...
> }
>
> OR
>
> Method 2: Use an associative array
> $result = mysql_query($query);
> while($row = mysql_fetch_assoc($result)) { // returns result row as an
> associative array
>     $admin_id = $row['AdminID'];
>     ....
> }
>

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

  Powered by Linux