Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

function problem involving query
I'm trying to construct a database of old houses including the parts
they are made of as roof construction, floor construction, types of
windows, vaults, etc. To do that I set up several tables. One
containing the house id, address, last visit, etc. For each of the
construction items there is a tabel containing the construction id and
the short description. Both tables should be linked by a table
containg the house id numbers and the fitting construction id numbers.
As there is much similarity in getting the right descriptions and
inserting the right values into the right tables I tried to make
functions to do that. Somehow this does't work.
An example for doing this for vaults is here:
(It is not in English, here follows a kind of translation)
......
Vault:
<select name = "vaulttype">
<?php
$sqlvlt = 'SELECT vaultnr, description FROM vaulttype ORDER BY
`vaultr` ASC';
$resultvlt =mysql_query($sqlvlt,$conn)or die("No vault type today");
while($row = mysql_fetch_row($resultvlt))
{
echo "<option value=\"";
echo $row[0]."\">";
echo $row[1]."</option>\n";
}
?>
</select>
<input type="submit" name="vault" value="Submit">
</FORM>
<?php
$thisisit = $_POST['vaulttype'];
//hereafter testing for double values and actually inserting
?>
.......
This works fine.

The function so far goes:
<?php
function getconstruction($construction){
global $houseid;
global $conn;
$a = $construction;
$b = $construction."type";
$c = $construction."nr";

echo $a.": ";
echo "<SELECT NAME = \"$b\">";
$sql = "SELECT $c, description FROM $b ORDER BY '$c' ASC";
$result = mysql_query($sql,$conn)or die(mysql_error());
while($row = mysql_fetch_row($result))
{
echo "<option value=\"";
echo $rij[0]."\">";
echo $rij[1]."</option>\n";
}
echo "</select>";
echo "<input type=\"submit\" name=\"$a\" value=\"Submit\">";
$gotconstruction = $_POST['vaulttype'];
return $gotconstruction;
}
getconstruction(vault);
?>

Now I get the list I ask for but further nothing whatsoever.
When I ask for the value of $gotconstruction the answer is vaulttype,
while when asking for $thisisit the answer is the number I want.

There are no error messages.

What is it I'm overlooking?
What is it I'm doing wrong?
How should I tackle this?

Thanks in advance,
Henny Boxa

Report this thread to moderator Post Follow-up to this message
Old Post
Henny Boxa
03-25-08 09:20 AM


Re: function problem involving query
On Wed, 26 Mar 2008 08:06:45 +0000 wrote David Quinton
<usenet_2005D_email@REMOVETHISBITbizorg.co.uk>:

>On Tue, 25 Mar 2008 09:21:58 +0100, Henny Boxa <tirelibom@hotnet.com>
>wrote:
> 
>
>I'm not totally sure I understand fully but AFAICT you're assuming
>that you are POSTING from within the Function.
>
>But the POST will be to the whole script - not just to that Function?

I'm afraid I was overlooking that.
Thank you,
Henny

Report this thread to moderator Post Follow-up to this message
Old Post
Henny Boxa
03-29-08 12:12 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:10 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.