newbie sunday morning non-enough-caffeine problem
| From: | kenn | Date: | Sun, 04 Jun 2000 16:24:36 +0000 |
| Subject: | newbie sunday morning non-enough-caffeine problem | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-189@lists.php.net to get a copy of this message | ||
Greetings.
This simple little problem has been driving me nuts
since I started this morning... hopefully one of you can
help me.
In essence, I need simply to read the variable "salesperson_code"
from the "salespersons" table and write it into the "job_info" table.
(The salesperson code may change in the future, so I want to record
it in the job_info table as it stands today.)
So far, no matter how I've tried to define "salesperson_code," I get
only the value of "0" written to my job_info table.
Here's a snippet of code:
<?php
mysql_connect ("localhost","root");
mysql_select_db ("bakergrfx");
$result = mysql_query("SELECT customer_code, customer_name,
salespersons.salesperson_code,
salesperson_name, csr from customer, salespersons
where customer.salesperson_code = salespersons.salesperson_code
and customer_code = '$customer_code'");
...
while($row = mysql_fetch_array($result)); } else {print "Sorry, no records
were found!";}
$sql = "INSERT INTO job_info (job_number, customer_code, salesperson_code)
VALUES ('$job_number', '$customer_code', '$salesperson_code') ";
$result = mysql_query($sql) or die("nope");
?>
Can anyone help me this morning? Thanks in advance,
Kenn