You are here: Re: Variable in select row « PHP Programming Language « IT news, forums, messages
Re: Variable in select row

Posted by Garry Jones on 10/08/06 18:25

"Mateusz Markowski" <mateusz@bsdmail.org> skrev i meddelandet
news:1160322153.961306.179050@k70g2000cwa.googlegroups.com...

> You should have written:

> $upgcollect="SELECT scfpwd1 FROM scfmforening WHERE scfmnum =
> $scfchknum";

No, I still can not get this working.

The examples on the net are complex and I can not deduce the simple line of
code that I need from them

This is the problem. Put simply

$var1=$_POST['anum'];
(inlogging mysql)
$var2="SELECT field2 FROM table1 WHERE field4 = $var1";
(logout mysql)
mysql_close();

(Need help with necessary code to assign variable $var2 to the value of
field4 for the record where users value is found)

I can not use the row index as that is assigned to another sequential value
and unknown to the user.

For instance

A table (table1) with the following fields

index, field2, town, townnum

Records of
1 abc dallas 5
2 def denver 3
3 ghh atlanta 17
4 gfe gateshead 24

The user knows the townnumber (5 or 8 or 17 or 24). The user does not know
the index, but townnum will always have a unique value.

He keys in his number.

I then want to look for the value of field 2 in the record where the user's
townnumber was found.

I then want to assign a variable to the value of the field2 in that record

If he types in 3 my code should assign the value of def to $var2

I understand its a combination of select, query and result but need help
with the syntax.

Any help greatly appreciated.

Garry Jones
Sweden

 

Navigation:

[Reply to this 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

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