Reply to Re: Set Variable to One Column

Your name:

Reply:


Posted by Gordon Burditt on 07/21/05 00:06

>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

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