|
Posted by dkruger on 10/09/07 21:09
On Oct 9, 4:04 pm, dkruger <davidkru...@techie.com> wrote:
> On Oct 9, 10:17 am, Terry <w...@rogers.com> wrote:
>
>
>
>
>
> > Hi folks.
> > I am just starting to dabble in php.
>
> > I am trying to do some simple pagination in php/mysql.
>
> > For whatever reason I am only getting the first digit of my result.
>
> > For example:
>
> > $result = mysql_query("select lamp_no from lamps as l where id=20");
> > $row = mysql_fetch_array($result);
> > echo "20 = " . $row[0]['l']
>
> > only displays 1 it should have displayed 15 for me.
>
> > Thanks,
> > Terry
>
> Not from the way your query looks. what happens if you run that exact
> query in your mysql client?
>
> what I would try is run the query:
>
> "select lamp_no as l from lamps where id=20"
>
> with my suggestion, l will be used for the column name instead of
> lamp_no. From the looks of your query, your column name would still
> be lamp_no instead of l.- Hide quoted text -
>
> - Show quoted text -
One thing when working with arrays, if you are unsure what might be
going on with data not matching what you expect, I would try using the
command print_r(array) to display the contents of the array, and all
of the keys etc. This will usually give you an idea where a problem
might be occuring in your code.
Navigation:
[Reply to this message]
|