|
Posted by J.O. Aho on 11/15/05 09:12
John MacLeod wrote:
> I'm trying to figure our how to execute a sql statement with a submit button
> but I'm going in circles...
>
> Here is the code I have come up with...
>
> ////// Reset database button /////////
> echo"<form name=\"reset_database\" method=\"post\" action=\"<? $PHP_SELF
> ?>\">
> <center><input type=\"submit\" name=\"enter_data\" value=\"Reset database
> after printing\"></center>
> </form>";
> if ($enter_data) {
> $sql = "UPDATE cubecartstore_order_inv SET order_from_supplier = '0'";
> }
> ////// UPDATE `cubecartstore_order_inv` SET `order_from_supplier` = '0'
> ////// Reset database button /////////
>
> I'm sure you can figure out what I'm trying to do, it's pretty simple. The
> statement works in phpmyadmin but nothing happens with this form. Please go
> easy on me as I'm very new to this. There's probably more then one thing I'm
> missing but I have to start somewhere.
>
> Any help would be greatly appreciated,
You need to send the data to the sql server, after you have logged in to it.
mysql - http://www.php.net/manual/en/ref.mysql.php
oracle - http://www.php.net/manual/en/ref.oracle.php
odbc - http://www.php.net/manual/en/ref.uodbc.php
msql - http://www.php.net/manual/en/ref.msql.php
There are support for even more sql servers in php (everything depends on what
options enabled during compile time).
you will need functions like *_connect(), *select_db() and *_query(), replace
the '*' with the one that is used for the database you are using.
//Aho
Navigation:
[Reply to this message]
|