[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Generate Auto Number - Update Mysql table

Asked by tofitadmin in PHP and Databases, MySQL Server, PHP Scripting Language

Tags: Dreamweaver

We are developing a webpage using Dreamweaver, php, and mysql as the backend.  One of the requirements is to generate an auto value based on the following syntax:

"sw" date(yymm) auto number (001)

an example would be:
sw0804001   for the first number in april 2008.

I am new at php and dreamweaver so I tried to mimic what worked in access, any better method of accomplishing this would be appreciated.  

What I have done is in mysql created 2 different fields; a sw field (default value is "sw") and an auto number field.  
I created a data entry php page where the person can enter in the needed information.  This form will create a new value in the sql table.  Once the new entry is created another php page is loaded.  My logic on this page is to run a sql query to find the new auto number value and update the entry with the sw value and the current date.  The output that I receive is "Your search warrant number is array0804array.  
All of my sql queries check out so I'm not sure why I'm receiving array as a response.  
" SELECT MAX(Number) FROM Search_Warrant_DB" returns the wanted value and so does

"SELECT MAX('SW') FROM Search_Warrant_DB"

Here is the php code that I created:


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
//connection is made
// make police1 the current db
$db_selected = mysql_select_db('police1', $link);
if (!$db_selected) {
    die ('HAHAHAHAHA: ' . mysql_error());
}
 
$query = "SELECT MAX(Number) FROM Search_Warrant_DB";
$query2 = "SELECT MAX('SW') FROM Search_Warrant_DB";
 
$query_config = mysql_query($query) or die(mysql_error());
$query_results_Number = mysql_fetch_assoc($query_config);
$numrows = mysql_num_rows($query_config);
$new_Number_value = $query_results_Number++ ;
 
$query_config2 = mysql_query($query2) or die(mysql_error());
$query_results_sw = mysql_fetch_assoc($query_config2);
 
?>
 
<?php
$date = date(ym);
$sw_number = $query_results_sw.$date.$new_Number_value;
 
$udpate_query = mysql_query("UPDATE Search_Warrant_DB SET SEARCH_WARRANT_NUMBER = $sw_number WHERE Number = $query_results_Number"); 
 
echo "Your Search Warrant Number is $sw_number.  Please keep this information.";
 
?>
[+][-]04/30/08 06:03 PM, ID: 21475793Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/30/08 09:48 PM, ID: 21476571Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/08 12:44 AM, ID: 21477008Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/08 12:49 AM, ID: 21477021Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/08 02:14 PM, ID: 21482808Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/01/08 04:27 PM, ID: 21483588Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/02/08 12:30 AM, ID: 21485051Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/02/08 03:59 PM, ID: 21490540Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/15/08 11:05 AM, ID: 21576516Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP and Databases, MySQL Server, PHP Scripting Language
Tags: Dreamweaver
Sign Up Now!
Solution Provided By: Goodangel
Participating Experts: 3
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628