Reply to Re: Set Variable to One Column

Your name:

Reply:


Posted by jhwrightiii on 07/21/05 00:15

I appreciate it. I am new in PHP. I knew about the result handle and
was just trying to show an example. In other languages I am able to
do something similar to that example all in one line and is what I was
aiming for. Two extra lines will do though.

Again thanks for you Help.

On Wed, 20 Jul 2005 21:06:58 -0000, gordonb.sf1ma@burditt.org (Gordon
Burditt) wrote:

>>Is it possible to set a variable from a query that will return one
>>row ie..
>>
>>$control = mysql_query("SELECT control FROM table WHERE id = '1'");
>
>Yes, but $control is a MySQL result handle, not the value.
>To get the value (and there are a number of different ways to do this,
>and you really need to do some error checking in case there was no
>row with id = 1):
>
> $r = mysql_fetch_result($control);
> $value = $r[0];
> /* we now have the value you wanted in $value */
> echo "$value";
> mysql_free_result($control);
>
> Gordon L. Burditt
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация