You are here: please Help me out with this « PHP SQL « IT news, forums, messages
please Help me out with this

Posted by Steff on 10/12/87 11:42

Hello every one,

I need your help because I have no idea how to do this...

how can I get the veg_id into the table veg_type according to the vegetable
name
chosen in the pick list ?

do I have to create another query in test2.php which select the veg_id
from the vegetable table ?

I would like to no what's best, I mean what's professional?

I created those two tables for my test:

create table vegetables (
veg_id number(5),
veg_name varchar2(30));

insert into vegetables values (1,'carot');
insert into vegetables values (2,'spinach');
insert into vegetables values (3,'potato');
insert into vegetables values (4,'tomato');
insert into vegetables values (5,'turnip');

create table veg_type (
type_id number(5));

here is my first php
page=====================================================

<html>

<head>

<title>test insert</title>

</head>

<body>

<p>test insert into db</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<form method="POST" action="test.php">

<p><input type="text" name="vegy_name" size="20"><input type="submit"
value="insert" name="B1"><input type="reset" value="reset" name="B2"></p>
</form>

<p>&nbsp;</p>

<form method="POST" action="test2.php">

<p><select size="1" name="D1">
<option selected>Vegy Name</option>

<?php

$c1=oci_connect("stephane","Stef1975",$bdtest05);

$query="select veg_name from vegetables";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

// here I get to chose what vegetable I want (it works fine)

while ($row = oci_fetch_array($stmt,OCI_NUM))
{
print "<option>";
echo $row[0];
print "</option>";
}

oci_free_statement($stmt);

//close connexion
oci_close($c1);
?>

</select><input type="submit" value="insert" name="b3"><input type="reset"
value="Reset" name="B4"></p>
</form>

</body>

</html>

and here is my second php
page========================================================


<?php

$veg= $_POST['D1'];


$c1=oci_connect("stephane","Stef1975",$bdtest05);

// I have a question mark here because I don't know how to do it

$query="insert into veg_type (id_type) values (?)";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);


oci_free_statement($stmt);


oci_close($c1);

?>

// thanks for looking!

//stephane

 

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

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