473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

The reapeating dilema

Sorry if I have many question. This is because I just new to html stuff

including php and mysql. My new problem is about php that connect to
mysql. I have this idea about updating record about document tracking.
But when I run my script for the first time in one session, there is no

problem, but when I add new record it does repeating. I meant when the
first
time I entry the data the number is 1, the second time I doing it
the number became 3. I checked the database; I got
confused because it has the record between number 1 and number 3. Use 2

table tbltahun and tblsurat This is my script:
require_once("surat.php");
session_start();
$year_now=date("Y");
$r_year=mysql_query("Select Number,Year from tblyear where
Year='$year_now'");
if (mysql_num_rows($r_year)!=1)
{
//if there is no number create new
$new_digit=1;
}
else
{
$new_digit=mysql_result($r_year,0)+1;
$r_new_digit=mysql_query("UPDATE tblyear SET Number='$new_digit' WHERE
Year='$year_now'");
}
-
-
$new_number="$new_digit/$new_company/$new_location/$new_month/$new_year";

-
-
-
$s_query_save="insert into tblmail values
('','$new_number','$topic','$attach','$destination ','$up','$date','$UserName','$division
','$modif','')";
$r_new_number=mysql_query($s_query_save);
if (!$r_new_number)
{
// some code to tell there is something wrong
exit;
}
else
{
echo "$new_number";

May 2 '06 #1
0 876

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: beezmnet | last post by:
Well... I need to be able to have a large block of HTML code inside a PHP document, assign it a variable, and use other variables, functions, and objects within the HTML code still. ...
4
by: Support | last post by:
Hello: I wrote a vb6 "client-side" ActiveX Component that will extract the user's network login. Now I want to be able to do some server-side work with this info, and it would be great if I could...
0
by: Nick | last post by:
Hi guys, I have an old VB app that writes just fine to an old LPT printer. I do this using: Open "LPT1" .... Now, the app is changing and I have to do the same thing in .NET. I found at...
1
by: Job Lot | last post by:
how to genrate random colors without repeat of the same color or color code. I am creating a line graph using ComponentOne Chart control and what to show series with different colors. thanx
2
by: dthmtlgod | last post by:
I have many other sites that use the same format, the textbody of the e-mail is not coming through on this page. Can't understand why. Nothing shows after the subject. Set cdoConfig =...
0
by: ma740988 | last post by:
Puzzled about an implementation here. In a vendor file, I'm faced: // vendors_file.h #ifdef __cplusplus typedef void (*VOIDFUNCPTR) (...); /* pfunction returning void */ #else...
1
by: aww | last post by:
Hi all, I'm having a hard time finding a creative way to mark a block of records based on a single condition within the recordset: Record | Client | Date | Attendance |...
6
by: Jason | last post by:
Here is the problem. I have two tables. The first table from the Credit Card Vendor. I have grouped it by date and it has three fields Store Date AmexAmount
0
by: aswincts | last post by:
Hi all, I want to display a table based on the value selected inthe combo box. Please help me how can i do that
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.