Re: mysql_query
| From: | Philip Thompson | Date: | Tue, 12 Oct 2004 14:53:31 +0000 |
| Subject: | Re: mysql_query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36755@lists.php.net to get a copy of this message | ||
On Oct 12, 2004, at 7:15 AM, ballo1@pinkponk.com wrote:
hello, I have a begining question. I've got simple html form and php script, but insert doesn' t work. What is wrong in my insert mysql_query? mysql_query( "insert into obiskovalci (ime, priimek, ulica, hstevilka, pstevilka, posta) values('$ime', '$priimek', '$ulica', '$hstevilka', '$pstevilka', '$posta')");There's a little more you need. First you have to use the connection you should have already opened up: $link = mysql_connect('some_db', 'some_user', 'some_pw'); Then you have to include the
link whenever you do a query:
mysql_query("your query", $link);
If I recall, you may not actually have to include the link every single time if you have already established which one you're using... but it's always safe to specify which one you're using. Maybe someone can clarify on this.
There is also id, which is auto_increment. After fill form and press Submit, id is writen in table, but there is no other inputs. Nothing, except "id".Yes, consider using the $_POST["some_variable"] to obtain the values.
thanks for answers BR, BaloHope this helped a tiny bit. ~Philip