mysql_fetch_array

This is a discussion on mysql_fetch_array within the PHP General forums, part of the PHP Programming Forums category; Have a problem that is driving me nuts. I have a simple script for viewing all the information in a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-21-2004
CitizenX
 
Posts: n/a
Default mysql_fetch_array

Have a problem that is driving me nuts. I have a simple script for viewing
all the information in a db table and sorting it accoring to user
selections. The annoy part is I have it working great on my local machine
(EasyPhp 1.7) but when I put it on the main server (win2k) it stumbles and
gives me an error everytime I call mysql_fetch_array

example of script:

$query = "SELECT ". $inv_items. " FROM inv_2004". $order_by;
$result =mysql_query($query);

while($row=mysql_fetch_array($result))
{
echo"$row[item]\r";
}

(eg of running script(not working))
http://jvlapps.nsuok.edu:8080/invent...b_display.php?
order_sortby=sn&asc=asc


can someone please point me in the right direction to figure this out? I am
assuming that some setting difference between the two servers is the
primary cause but I don't know where to look.


N8
Reply With Quote
  #2 (permalink)  
Old 06-03-2004
Robert Hoffman
 
Posts: n/a
Default Re: mysql_fetch_array

You are either extremely advanced or completely lost....

this code

| $query = "SELECT ". $inv_items. " FROM inv_2004". $order_by;
| $result =mysql_query($query);

makes no sense.....

I imagine you mean this

$huh= "whatever the heck column you want it ordered by";
$result=mysql_query("select inv_item,$huh from inv_2004 order by '$huh'");

assuming inv_2004 is a table.... item and $huh are column names (substitue
$huh with a column name you want it ordered by)

"CitizenX" <list_serve@No_hotmail-SPAM.com> wrote in message
news:Xns94F07AA7BA42FlistserveNohotmailSP@129.250. 170.84...
> Have a problem that is driving me nuts. I have a simple script for viewing
> all the information in a db table and sorting it accoring to user
> selections. The annoy part is I have it working great on my local machine
> (EasyPhp 1.7) but when I put it on the main server (win2k) it stumbles and
> gives me an error everytime I call mysql_fetch_array
>
> example of script:
>
> $query = "SELECT ". $inv_items. " FROM inv_2004". $order_by;
> $result =mysql_query($query);
>
> while($row=mysql_fetch_array($result))
> {
> echo"$row[item]\r";
> }
>
> (eg of running script(not working))
> http://jvlapps.nsuok.edu:8080/invent...b_display.php?
> order_sortby=sn&asc=asc
>
>
> can someone please point me in the right direction to figure this out? I

am
> assuming that some setting difference between the two servers is the
> primary cause but I don't know where to look.
>
>
> N8



Reply With Quote
  #3 (permalink)  
Old 06-07-2004
crashover
 
Posts: n/a
Default Re: mysql_fetch_array

When you have multiple tables with a same fieldname you can use aliases:

SELECT table1.field as field1, table2.field as field2...
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0