Hello

I'm new to sql (sql 2000 database) and i'm trying to get two simple things.

I have two sql queries that i run in order to display a result and to update another one.


The queries that i run in sql query analizer are:

1. select memb_guid from MEMB_INFO where memb___id='account'

2. update MuCashShop_DATA set CashPoint=CashPoint+10 where memb_guid='id'

So the 1st query displays the number of member_guid according to the account i enter and the 2nd query updates a table according tot he number that i obtain from the first query.


Instead of running these two queries everytime in query analizer i would like to do it directly from a website page.

So for the first query i should have a search box where i add the account name and it will give me the memb_guid result which is a number. Example: i enter account name test , hit search and it should display me the memb_guid number for that account like 121

And the second query it should have two boxes: one where i add the number from memb_guid displayed in the first query and in the second box i should add the number that will update cashpoints ( in my example is the 10 from CashPoint=CashPoint+10) value number.
Example: adding to member 121 (first box) + 500 cashpoints (second box) to the ones which he already has. Hit the update button and he should have his account edited


Thank you in advance

You could have something like this for your page to get the details.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Get Details</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="get_memb_gui">
  <label>Member_Guid: </label>
  <input type="text" name="memguid" />
  <input type="submit" value="Get Memb_guid" />
</form><br />
<?php 
@$membguid=$_POST['memguid'];
?>
<form action="update.php" method="post" name="update">
  <label>Member_Guid: </label>
  <input type="text" name="memguid" value="<?php echo $membguid; ?>"/>
  <br />
  <label>Cashpoints to Add: </label>
  <input type="text" name="cashpoints" />
  <input type="submit" value="Update" />
</form>
</body>
</html>

And this sends to update.php, which is where you would have you sql statements.

\\connect to your database
\\\get the variables $cashpoints=$_POST;

then
1. select memb_guid from MEMB_INFO where memb___id='account'

2. update MuCashShop_DATA set CashPoint=CashPoint+10 where memb_guid='id'

MAke sure you sanitize any user input!

Sorry, i just read the bit where it said your new to sql. It might have helped if i included the sql part. When i get time later today i will upload an example for you:)