in reply to Re: Bind and fetch fails
in thread [SOLVED]Bind and fetch fails
*Updated* I didn't prepare other Select, all that I did for the exercise is in the code posts. I thought about what you said and I thought that probably bind_column was useless because I just wanted print the values of the variables presents in the table and maybe it's not important to bind them to columns so, trying to think in a simpler way, I removed the while cycle and the subsequent fetch replacing them with a simple print of variables.
I also changed the assigment of keywords inserted in the form html of the first script to the variables in databaseLWP(the script that I'm modifying) in a more correct way, now the reply-page returns the correct valor(except id), but not from table, just from html form, in fact the id value isn't shows.
At least I found the bug that caused the problem with inclusion of the value in databases and was the mysql syntax in the query(I missed the '' near the names of values), a common beginner mistake, but I also changed the ? with directly name of the variables because if I didn't it the query inserted only ? instead of values.
With these modifications the script now puts the value in the database but without enough security in my opinion, what do you suggest?
(...) #prepare the query my $sql = "INSERT INTO prodotti (nome_prod , tipologia_prod) VALUES (' +$key_nome_prod' , '$key_tipo_prod' )" ; my $sth = $dbh->prepare( $sql ); #$sth->bind_param( $key_nome_prod , $key_tipo_prod ); (...) print "<i>La lista aggiornata dei prodotti presenti nel database negoz +i è:</i> <br><br>"; print " ============================================================== +===== <br><br>"; print "<i>Id del prodotto=</i><b> $id_prod </b>,<i> il nome del prodot +to è</i><b> $key_nome_prod </b> della tipologia $key_ti$
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Bind and fetch fails
by hippo (Archbishop) on Dec 15, 2015 at 10:51 UTC |