note 99239 added to function.mysql-insert-id
| From: | daniel_chereji at hotmail dot com | Date: | Thu, 05 Aug 2010 11:20:40 +0000 |
| Subject: | note 99239 added to function.mysql-insert-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171391@lists.php.net to get a copy of this message | ||
Hi everyone,
i have this php script:
<html>
<head>
<link rel="stylesheet" href="/style/MYSTYLE.CSS"
type="text/css">
<meta name="verify-v1" content="52vQ/BcSvsm6MlAsynpikrmlr2b9x0Q5Xam38QWYKcc="
>
</head>
<body>
<table bgcolor="#ffffff" width="100%" height="100%"
align="center" border="0"><tbody
valign="top"><tr><td width="100%" height="100%"
align="center">
<form name="formular" action="adauga_tablou_db.php"
method="POST"><table><tbody
valign="top"><tr><td><p>Nume
tablou</p></td><td><input type="text" name="nume_tablou"
/></td><td></tr>
<tr><td><p>Numar inregistrari</p></td><td><input
type="text" name="numar_inregistrari" /></td><td></tr>
<tr><td></td><td><input type="submit"
name="adauga_tablou" value="Adaugă"/><input
type="reset" name="reset" value="Şterge"
/></td></tr></tbody></table></form>
<?php
$nume_tablou=$_POST['nume_tablou'];
$numar_inregistrari=$_POST['numar_inregistrari'];
$daniel = fopen("logare.daniel","r") ;
$citeste = fscanf ($daniel, "%s\t%s\t%s\t%s") ;
list ($h,$u,$p,$d) = $citeste;
$host=$h; // Host name
$username=$u; // Mysql username
$password=$p; // Mysql password
$db_name=$d; // Database name
mysql_connect("$host", "$username", "$password")or die("cannot
connect"); mysql_select_db("$db_name")or die("cannot select DB");
/*$creaza_tablou=mysql_query("CREATE TABLE Metatag(CelCareNumaraTotTimpul INT NOT NULL
AUTO_INCREMENT,
PRIMARY KEY(CelCareNumaraTotTimpul),
metataguri VARCHAR(40000))");
if(!$creaza_tablou){ echo"<br />Nu s-a creat tabloul!".mysql_error(); }
else{echo"<br />S-a creat tabloul!";}*/
fclose($daniel);
if(isset($_POST['adauga_tablou'])){
$nume_tablou=$_POST['nume_tablou'];
$numar_inregistrari=$_POST['numar_inregistrari'];
$scrie=fopen("numar_inregistrari.dan","w");
$scrie=fwrite($scrie,"%d".$numar_inregistrari);
echo"<p><small>Numar inreg:".$numar_inregistrari."</small><br
/>";
if(empty($nume_tablou) || empty($numar_inregistrari)){ die('Sărăcie la
completare!');}
echo"<form name='formular1' action='adauga_tablou_db.php'
method='POST'><table><tbody><tr><td></td><td><p><b>Nume
inregistrare</b></p></td><td><p><b>Tipul
inregistrarii</b></p></td><td><p><b>Lungimea
Inregistrarii<input type='hidden' name='fantoma'
value='".$numar_inregistrari."'
/></b></p></td></tr>";
for($i=1;$i<=$numar_inregistrari;$i++){
echo"<tr><td><p><b>".$i."</b></p></td><td><input
type='text' name='nume_inregistrare".$i."'
/></td><td><select
name='tip_inregistrare".$i."'><option
value='1'>INT</option><option
value='2'>VARCHAR</option><option
value='3'>TEXT</option><option
value='4'>DATE</option></select></td><td><input
type='text' name='lungime_inregistrare".$i."'
/></td></tr>";}
echo"<tr><td></td><td><input type='submit'
name='adauga_tablou1' value='Adauga tablou' /><input
type='reset' name='sterge' value='Sterge tot'
/></td></tr></tbody></table></form>";
fclose($scrie);
}
if (isset($_POST['adauga_tablou1'])) {
$fantoma=$_POST['fantoma'];
echo"Numar inreg.:".$fantoma;
for($d = 1; $d <= $fantoma; $d++) {
$nume_inregistrare[$d]=$_POST['nume_inregistrare[$d]'];
echo"-->".$nume_inregistrare[$d]."<--<br />";
}
}
?>
</td></tr></tbody></table>
</body></html>.
Ok, all is working but i cannot read the values of text fields named "nume_inregistrare"
and "tip_inregistrare" and "lungime_inregistrare" from form
"formular1" vhen press the submit button named "adauga_tablou1".I try here
f (isset($_POST['adauga_tablou1'])) {
$fantoma=$_POST['fantoma'];
echo"Numar inreg.:".$fantoma;
for($d = 1; $d <= $fantoma; $d++) {
$nume_inregistrare[$d]=$_POST['nume_inregistrare[$d]'];
echo"-->".$nume_inregistrare[$d]."<--<br />";
}
}
to read the values of nume_inregistrare and tip_inregistrare and lungime_inregistrare.If have an
idea about my problem please answer me.Thanks a lot
----
Server IP: 69.147.83.197
Probable Submitter: 95.76.64.83
----
Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php
Edit -- https://master.php.net/note/edit/99239
Del: integrated -- https://master.php.net/note/delete/99239/integrated
Del: useless -- https://master.php.net/note/delete/99239/useless
Del: bad code -- https://master.php.net/note/delete/99239/bad+code
Del: spam -- https://master.php.net/note/delete/99239/spam
Del: non-english -- https://master.php.net/note/delete/99239/non-english
Del: in docs -- https://master.php.net/note/delete/99239/in+docs
Del: other reasons-- https://master.php.net/note/delete/99239
Reject -- https://master.php.net/note/reject/99239
Search -- https://master.php.net/manage/user-notes.php