I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im sorting out a few glitches though.
Since i upgraded from ms access database to MySQL, i have added about 4 articles to test the new setup. I note some fields aren't being added in the new mySql database for the new 4 records. When i ran the MySQK query analyser and checked to see what was in the database fields.. the "fldCreated " shows NULL, when it should be showing a date. In the query analyser, the dates BEFORE the new mysql database show: nm_tbl_news n;
2008-10-15 08:28:31
but in the few articles i added after the transfer it doesn't have a date, it says NULL, which means the code adding the date to the database must be wrong.
I'm including some code from the newsadd.asp page, which is the page that is actually adding the news to the database and also some code from the include files on this page , which may be relevant
inc_api.asp
[code] - FUNCTION RFC822(dDate,iOffset)
-
Dim d
-
d = DateAdd("h",-iOffset,dDate)
-
RFC822 = Left(WeekDayName(WeekDay(d)),3) & ", " & Right(String(2,"0") & Day(d),2) & " " & Left(MonthName(Month(d)),3) & " " & Year(d) & " " & Right(String(2,"0") & Hour(d),2) & ":" & Right(String(2,"0") & Minute(d),2) & ":" & Right(String(2,"0") & Second(d),2) & " " & "GMT"
-
END FUNCTION
config.asp - <% Dim MyConn, APPLICATION_URL, arrLEVEL, SAFE_EXTENSIONS_ONLY, KEEP_LOGS, DB_TO_USE, ALL_ARTICLES_PAGE_SIZE, SET_EMAIL_COMP, SHOW_AUTHOR
-
Dim SEARCH_METHOD, SEARCH_IN, SEARCH_MODE, SEARCH_FOR
-
-
Session.LCID = 1033
-
-
-
-
' Set to 1 if you are using MS Access, set to 2 if you are using MS SQL database, 3 for MySQL
-
DB_TO_USE = 3
-
-
-
' Assemble date value
-
FUNCTION ASEMBLE_DATE_FORMAT(sDAY, sMONTH, sYEAR)
-
Dim DATE_FORMAT, sDATE
-
-
DATE_FORMAT = 1 ' US Locale
-
-
SELECT CASE DATE_FORMAT
-
CASE 1
-
sDATE = sMONTH & "/" & sDAY & "/" & sYEAR
-
CASE ELSE
-
sDATE = sMONTH & "/" & sDAY & "/" & sYEAR
-
END SELECT
-
ASEMBLE_DATE_FORMAT = sDATE
-
END FUNCTION
-
-
-
-
<% '// NO NEED TO MODIFY ANYTHING BELOW
-
FUNCTION CNT_DATE(sDATE)
-
IF IsDate(sDATE) = True THEN
-
-
SELECT CASE DATE_FORMAT
-
CASE 1 'YYYYMMDD
-
CNT_DATE = Year(sDATE) & Right(Cstr(Month(sDATE) + 100),2) & Right(Cstr(Day(sDATE) + 100),2)
-
CASE 2 'YYYY-MM-DD
-
CNT_DATE = Year(sDATE) & "-" & Right(Cstr(Month(sDATE) + 100),2) & "-" & Right(Cstr(Day(sDATE) + 100),2)
-
CASE 101 'mm/dd/yy
-
CNT_DATE = Right(Cstr(Month(sDATE) + 100),2) & "/" & Right(Cstr(Day(sDATE) + 100),2) & "/" & Right(Cstr(Year(sDATE)),2)
-
CASE 102 'yy.mm.dd
-
CNT_DATE = Right(Cstr(Year(sDATE)),2) & "." & Right(Cstr(Month(sDATE) + 100),2) & "." & Right(Cstr(Day(sDATE) + 100),2)
-
CASE 103 'dd/mm/yy
-
CNT_DATE = Right(Cstr(Day(sDATE) + 100),2) & "/" & Right(Cstr(Month(sDATE) + 100),2) & "/" & Right(Cstr(Year(sDATE)),2)
-
CASE 104 'dd.mm.yy
-
CNT_DATE = Right(Cstr(Day(sDATE) + 100),2) & "." & Right(Cstr(Month(sDATE) + 100),2) & "." & Right(Cstr(Year(sDATE)),2)
-
CASE 105 'dd-mm-yy
-
CNT_DATE = Right(Cstr(Day(sDATE) + 100),2) & "-" & Right(Cstr(Month(sDATE) + 100),2) & "-" & Right(Cstr(Year(sDATE)),2)
-
CASE 110 'mm-dd-yy
-
CNT_DATE = Right(Cstr(Month(sDATE) + 100),2) & "-" & Right(Cstr(Day(sDATE) + 100),2) & "-" & Right(Cstr(Year(sDATE)),2)
-
CASE 111 'yy/mm/dd
-
CNT_DATE = Right(Cstr(Year(sDATE)),2) & "/" & Right(Cstr(Month(sDATE) + 100),2) & "/" & Right(Cstr(Day(sDATE) + 100),2)
-
CASE 112 'yymmdd
-
CNT_DATE = Right(Cstr(Year(sDATE)),2) & Right(Cstr(Month(sDATE) + 100),2) & Right(Cstr(Day(sDATE) + 100),2)
-
END SELECT
-
ELSE
-
CNT_DATE = Null
-
END IF
-
END FUNCTION
-
%>
and this is the page that adds the news to the database, ive tried to only include relevant code, (or that which i think is relevant) as it is a long page, .
newsadd.asp - <!--#include file="inc_api.asp"-->
-
<!--#include file="config.asp"-->
-
-
<%Dim MODE, MESSAGE, CATE_STR, SQL, RS, CATE, AGENT, ACTIVE, ALLOW_C, ALLOW_V, TITLE, SUMMARY, IMAGE, CONTENT, I, _
-
arrCATE, ID, sDATE, eDATE, TID, TEMPLATE, A_C, A_V, APPROVE, HLITE, AGENT_STR, USE_VIEW
-
-
MODE = Request.Form("mode")
-
TID = Trim(Request.QueryString("TID"))
-
-
-
Call CREATE_SECURITY()
-
IF NOT Trim(arrLEVEL(27)) = "1" THEN MESSAGE = "<li />Sorry, you don't have access to this section."
-
-
'
-
'<description> add new article to the DB </description>
-
'
-
IF MODE = "add" THEN
-
-
With Request
-
arrCATE = Split(APO(.Form("cate")),",")
-
AGENT = APO(.Form("agent"))
-
ACTIVE = CONVERT_NUM(.Form("active"))
-
ALLOW_C = CONVERT_NUM(.Form("allow_c"))
-
ALLOW_V = CONVERT_NUM(.Form("allow_v"))
-
TITLE = APO(.Form("title"))
-
SUMMARY = APO(STRIP_CODE(.Form("summary")))
-
USE_VIEW = APO(.Form("USE_VIEW"))
-
IMAGE = APO(.Form("image"))
-
CONTENT = APO_LAX(.Form("content"))
-
IF DB_TO_USE = 3 THEN
-
sDATE = .Form("sY") & "-" & .Form("sM") & "-" & .Form("sD")
-
eDATE = .Form("eY") & "-" & .Form("eM") & "-" & .Form("eD")
-
ELSE
-
sDATE = ASEMBLE_DATE_FORMAT(.Form("sD"),.Form("sM"),.Form("sY"))
-
eDATE = ASEMBLE_DATE_FORMAT(.Form("eD"),.Form("eM"),.Form("eY"))
-
END IF
-
HLITE = CONVERT_NUM(.Form("hlite"))
-
End With
-
-
Call CHECK_INP()
-
-
IF MESSAGE = "" THEN
-
'
-
'<description> add article </description>
-
'
-
ELSE
-
SQL = "INSERT INTO nm_tbl_news (fldTITLE, fldCONTENT, fldSUMMARY, fldACTIVE, fldAID, fldPOSTED, fldEXPIRES, fldIMAGE, fldALLOW_COMMENTS, fldALLOW_VOTING, fldHIGHLIGHT, fldUSE_VIEW) VALUES ('" & TITLE & "','" & CONTENT & "','" & SUMMARY & "'," & ACTIVE & "," & AGENT & ",'" & sDATE & "','" & eDATE & "','" & IMAGE & "'," & ALLOW_C & "," & ALLOW_V & "," & HLITE & ", " & USE_VIEW & ")"
-
END IF
-
Call OPEN_DB()
-
-
MyConn.Execute SQL
-
-
SQL = "SELECT ID FROM nm_tbl_news WHERE fldTITLE='" & TITLE & "' AND fldAID = " & AGENT & " ORDER BY ID DESC"
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
ID = trim(RS("ID"))
-
END IF
-
RS.Close
-
-
'
-
'<description> add category association </description>
-
'
-
FOR I = 0 to Ubound(arrCATE)
-
IF IS_VALID_ID(Trim(arrCATE(I))) = True THEN
-
SQL = "INSERT INTO nm_tbl_news_cate (fldNEWS_ID, fldCATE_ID) VALUES (" & ID & "," & Trim(arrCATE(I)) & ")"
-
MyConn.Execute SQL
-
END IF
-
NEXT
-
-
' { Append New Log Lin }
-
Call APPEND_LOG(False, "Added new article ( " & TITLE & " ).", Session("ID"))
-
-
MyConn.close
-
Set MyConn = Nothing
-
-
Response.Redirect "news.asp"
-
Response.End
-
END IF
-
-
ELSE
-
-
Call OPEN_DB()
-
'
-
'<description> Create the category drop down </description>
-
'
-
-
IF DB_TO_USE = 3 THEN
-
SQL = "SELECT ID, fldNAME, ID as ID1, 0 as ID2, 0 as ID3 FROM nm_tbl_cate WHERE fldLEVEL = 1 UNION SELECT nm_tbl_cate.ID, CONCAT(PARENT.fldNAME , ' > ' , nm_tbl_cate.fldNAME) AS NAME, PARENT.id, nm_tbl_cate.ID, 0 FROM nm_tbl_cate, nm_tbl_cate AS PARENT WHERE (nm_tbl_cate.fldLEVEL = 2) AND (nm_tbl_cate.fldPID =PARENT.ID) UNION SELECT nm_tbl_cate.ID, CONCAT(PARENT.fldNAME , ' > ' , SUBPARENT.fldNAME , ' > ' , nm_tbl_cate.fldNAME) AS NAME, PARENT.id, SUBPARENT.id, nm_tbl_cate.ID FROM nm_tbl_cate, nm_tbl_cate AS PARENT, nm_tbl_cate AS SUBPARENT WHERE (nm_tbl_cate.fldLEVEL = 3) AND (nm_tbl_cate.fldPID =PARENT.ID) AND (nm_tbl_cate.fldSID =SUBPARENT.ID) ORDER BY `fldName` ASC"
-
ELSE
-
END IF
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
-
-
RS.Open SQL, MyConn
-
WHILE NOT RS.EOF
-
CATE_STR = CATE_STR & "<option value='" & trim(RS("ID")) & "'>" & trim(RS("fldNAME")) & vbcrlf
-
RS.MoveNext
-
WEND
-
RS.Close
-
'
-
-
ELSE
-
IF Session("ID") = trim(RS("ID")) THEN
-
AGENT_STR = AGENT_STR & "<option selected='selected' style='background-color: #ffffea' value='" & trim(RS("ID")) & "'>" & trim(RS("fldNAME")) & vbcrlf
-
END IF
-
END IF
-
RS.MoveNext
-
WEND
-
RS.Close
-
-
IF IS_VALID_ID(TID) THEN
-
-
SQL = "SELECT fldTEMPLATE FROM nm_tbl_template WHERE ID = " & TID
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
TEMPLATE = trim(RS("fldTEMPLATE"))
-
END IF
-
RS.Close
-
-
END IF
-
-
SQL = "SELECT fldA_V, fldA_C, fldAPPROVE FROM nm_tbl_settings WHERE ID = 1"
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
A_C = Trim(RS("fldA_C"))
-
A_V = Trim(RS("fldA_V"))
-
APPROVE = Trim(RS("fldAPPROVE"))
-
END IF
-
RS.Close
-
-
Set RS = Nothing
-
MyConn.Close
-
Set MyConn = Nothing
-
-
END IF
-
-
-
%>
-
-
-
-
<table width="100%" align="center" cellpadding="2" cellspacing="0" border="0">
-
<tr>
-
-
</tr>
-
</table>
-
<br />
-
<table width="100%" align="center" cellpadding="2" cellspacing="0" border="1" bordercolor="whitesmoke" style="border-collapse: collapse;">
-
<tr bgcolor="whitesmoke">
-
<td class="MainTitle">Add New Article</td>
-
<td class="MainTitle" align="right">< <a href="templates.asp">Apply Template</a> ></td>
-
</tr>
-
<tr>
-
<td colspan="2">
-
<br />
-
-
<form action="newsadd.asp" method="post" name="frm">
-
<table cellpadding="2" cellspacing="0" border="0" align="center" width="622">
-
<tr>
-
<td>Article By:</td>
-
<td align="right"><select name="agent" class="textbox" style="width: 450px;"><%= AGENT_STR %></select></td>
-
</tr>
-
<tr>
-
-
<td>Publish Date:</td>
-
<td><select name="sM" id="sM"><%FOR I = 1 TO 12%><option<%If Trim(I) = Trim(Month(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td><select name="sD" id="sD"><%FOR I = 1 TO 31%><option<%If Trim(I) = Trim(day(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td><select name="sY" id="sY"><%FOR I = 2001 TO 2030%><option<%If Trim(I) = Trim(Year(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td></td>
-
</tr></table>
-
</td>
-
<td>
-
<table align="right" cellpadding="2" cellspacing="0" border="0"><tr>
-
<td>Expires Date:</td>
-
<td><select name="eM" id="eM"><%FOR I = 1 TO 12%><option<%If Trim(I) = Trim(Month(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td id="eD"><select name="eD" id="eD"><%FOR I = 1 TO 31%><option<%If Trim(I) = Trim(Day(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td><select name="eY" id="eY"><%FOR I = 2001 TO 2030%><option<%If Trim(I) = Trim(Year(Date+365)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td></td>
-
</tr></table>
-
</td>
-
</tr></table>
-
-
</td>
-
</tr>
-
-
</td>
-
</tr><tr>
-
<td colspan="2" align="right"><br /><input type="Submit" value="Add Article" onClick="return ValidateNewsArticle()" /><br /></td>
-
</tr></table>
-
<input type="Hidden" name="mode" value="add" />
-
</form>
-
<br /><br />
-
</td>
-
</tr>
-
</table>
-
-
<!--#include file="inc_footer.asp"-->
I'd appreciate it if anyone could show me what to change and where. I'm not html literate, and realise the code above is probably not written in the best way, but im just concerned with getting it to function.
Much appreciated and thanks in advance
3 3530
On line 47 of your news_add.asp, there is no reference to a "fldCreated " in your SQL query. That means no value would be input to your table when this script fires off.
I have modified your file with important changes. See lines 18 - 23.
I created a new variable 'CREATE_DATE'.
The code on line 21 formats this date as "MM/DD/YYY"
Line 22 is just so I can get around modifying other files and thus complicating this for you.
Line 23 formats the date for MySQL insertion.
Skip to line 53 now. It now includes fldCreated.
Try this and let me know if it works. - <!--#include file="inc_api.asp"-->
-
<!--#include file="config.asp"-->
-
-
<%Dim MODE, MESSAGE, CATE_STR, SQL, RS, CATE, AGENT, ACTIVE, ALLOW_C, ALLOW_V, TITLE, SUMMARY, IMAGE, CONTENT, I, _
-
arrCATE, ID, sDATE, eDATE, TID, TEMPLATE, A_C, A_V, APPROVE, HLITE, AGENT_STR, USE_VIEW
-
-
MODE = Request.Form("mode")
-
TID = Trim(Request.QueryString("TID"))
-
-
-
Call CREATE_SECURITY()
-
IF NOT Trim(arrLEVEL(27)) = "1" THEN MESSAGE = "<li />Sorry, you don't have access to this section."
-
-
'
-
'<description> add new article to the DB </description>
-
'
-
IF MODE = "add" THEN
-
''// added by nicodemas
-
twoDay = day(date) : if twoDay < 10 then twoDay = "0" & twoDay
-
twoMonth = month(date) : if twoMonth < 10 then twoMonth = "0" & twoMonth
-
CREATE_DATE = ASEMBLE_DATE_FORMAT(twoDay,twoMonth,year(date))
-
DATE_FORMAT = 2
-
CREATE_DATE = CNT_DATE(CREATE_DATE)
-
-
With Request
-
arrCATE = Split(APO(.Form("cate")),",")
-
AGENT = APO(.Form("agent"))
-
ACTIVE = CONVERT_NUM(.Form("active"))
-
ALLOW_C = CONVERT_NUM(.Form("allow_c"))
-
ALLOW_V = CONVERT_NUM(.Form("allow_v"))
-
TITLE = APO(.Form("title"))
-
SUMMARY = APO(STRIP_CODE(.Form("summary")))
-
USE_VIEW = APO(.Form("USE_VIEW"))
-
IMAGE = APO(.Form("image"))
-
CONTENT = APO_LAX(.Form("content"))
-
IF DB_TO_USE = 3 THEN
-
sDATE = .Form("sY") & "-" & .Form("sM") & "-" & .Form("sD")
-
eDATE = .Form("eY") & "-" & .Form("eM") & "-" & .Form("eD")
-
ELSE
-
sDATE = ASEMBLE_DATE_FORMAT(.Form("sD"),.Form("sM"),.Form("sY"))
-
eDATE = ASEMBLE_DATE_FORMAT(.Form("eD"),.Form("eM"),.Form("eY"))
-
END IF
-
HLITE = CONVERT_NUM(.Form("hlite"))
-
End With
-
-
Call CHECK_INP()
-
-
IF MESSAGE = "" THEN
-
'
-
'<description> add article </description>
-
'
-
ELSE
-
SQL = "INSERT INTO nm_tbl_news (fldCreated, fldTITLE, fldCONTENT, fldSUMMARY, fldACTIVE, fldAID, fldPOSTED, fldEXPIRES, fldIMAGE, fldALLOW_COMMENTS, fldALLOW_VOTING, fldHIGHLIGHT, fldUSE_VIEW) VALUES ('"& CREATE_DATE &"', '" & TITLE & "','" & CONTENT & "','" & SUMMARY & "'," & ACTIVE & "," & AGENT & ",'" & sDATE & "','" & eDATE & "','" & IMAGE & "'," & ALLOW_C & "," & ALLOW_V & "," & HLITE & ", " & USE_VIEW & ")"
-
END IF
-
Call OPEN_DB()
-
-
MyConn.Execute SQL
-
-
SQL = "SELECT ID FROM nm_tbl_news WHERE fldTITLE='" & TITLE & "' AND fldAID = " & AGENT & " ORDER BY ID DESC"
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
ID = trim(RS("ID"))
-
END IF
-
RS.Close
-
-
'
-
'<description> add category association </description>
-
'
-
FOR I = 0 to Ubound(arrCATE)
-
IF IS_VALID_ID(Trim(arrCATE(I))) = True THEN
-
SQL = "INSERT INTO nm_tbl_news_cate (fldNEWS_ID, fldCATE_ID) VALUES (" & ID & "," & Trim(arrCATE(I)) & ")"
-
MyConn.Execute SQL
-
END IF
-
NEXT
-
-
' { Append New Log Lin }
-
Call APPEND_LOG(False, "Added new article ( " & TITLE & " ).", Session("ID"))
-
-
MyConn.close
-
Set MyConn = Nothing
-
-
Response.Redirect "news.asp"
-
Response.End
-
END IF
-
-
ELSE
-
-
Call OPEN_DB()
-
'
-
'<description> Create the category drop down </description>
-
'
-
-
IF DB_TO_USE = 3 THEN
-
SQL = "SELECT ID, fldNAME, ID as ID1, 0 as ID2, 0 as ID3 FROM nm_tbl_cate WHERE fldLEVEL = 1 UNION SELECT nm_tbl_cate.ID, CONCAT(PARENT.fldNAME , ' > ' , nm_tbl_cate.fldNAME) AS NAME, PARENT.id, nm_tbl_cate.ID, 0 FROM nm_tbl_cate, nm_tbl_cate AS PARENT WHERE (nm_tbl_cate.fldLEVEL = 2) AND (nm_tbl_cate.fldPID =PARENT.ID) UNION SELECT nm_tbl_cate.ID, CONCAT(PARENT.fldNAME , ' > ' , SUBPARENT.fldNAME , ' > ' , nm_tbl_cate.fldNAME) AS NAME, PARENT.id, SUBPARENT.id, nm_tbl_cate.ID FROM nm_tbl_cate, nm_tbl_cate AS PARENT, nm_tbl_cate AS SUBPARENT WHERE (nm_tbl_cate.fldLEVEL = 3) AND (nm_tbl_cate.fldPID =PARENT.ID) AND (nm_tbl_cate.fldSID =SUBPARENT.ID) ORDER BY `fldName` ASC"
-
ELSE
-
END IF
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
-
-
RS.Open SQL, MyConn
-
WHILE NOT RS.EOF
-
CATE_STR = CATE_STR & "<option value='" & trim(RS("ID")) & "'>" & trim(RS("fldNAME")) & vbcrlf
-
RS.MoveNext
-
WEND
-
RS.Close
-
'
-
-
ELSE
-
IF Session("ID") = trim(RS("ID")) THEN
-
AGENT_STR = AGENT_STR & "<option selected='selected' style='background-color: #ffffea' value='" & trim(RS("ID")) & "'>" & trim(RS("fldNAME")) & vbcrlf
-
END IF
-
END IF
-
RS.MoveNext
-
WEND
-
RS.Close
-
-
IF IS_VALID_ID(TID) THEN
-
-
SQL = "SELECT fldTEMPLATE FROM nm_tbl_template WHERE ID = " & TID
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
TEMPLATE = trim(RS("fldTEMPLATE"))
-
END IF
-
RS.Close
-
-
END IF
-
-
SQL = "SELECT fldA_V, fldA_C, fldAPPROVE FROM nm_tbl_settings WHERE ID = 1"
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
A_C = Trim(RS("fldA_C"))
-
A_V = Trim(RS("fldA_V"))
-
APPROVE = Trim(RS("fldAPPROVE"))
-
END IF
-
RS.Close
-
-
Set RS = Nothing
-
MyConn.Close
-
Set MyConn = Nothing
-
-
END IF
-
-
-
%>
-
-
-
-
<table width="100%" align="center" cellpadding="2" cellspacing="0" border="0">
-
<tr>
-
-
</tr>
-
</table>
-
<br />
-
<table width="100%" align="center" cellpadding="2" cellspacing="0" border="1" bordercolor="whitesmoke" style="border-collapse: collapse;">
-
<tr bgcolor="whitesmoke">
-
<td class="MainTitle">Add New Article</td>
-
<td class="MainTitle" align="right">< <a href="templates.asp">Apply Template</a> ></td>
-
</tr>
-
<tr>
-
<td colspan="2">
-
<br />
-
-
<form action="newsadd.asp" method="post" name="frm">
-
<table cellpadding="2" cellspacing="0" border="0" align="center" width="622">
-
<tr>
-
<td>Article By:</td>
-
<td align="right"><select name="agent" class="textbox" style="width: 450px;"><%= AGENT_STR %></select></td>
-
</tr>
-
<tr>
-
-
<td>Publish Date:</td>
-
<td><select name="sM" id="sM"><%FOR I = 1 TO 12%><option<%If Trim(I) = Trim(Month(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td><select name="sD" id="sD"><%FOR I = 1 TO 31%><option<%If Trim(I) = Trim(day(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td><select name="sY" id="sY"><%FOR I = 2001 TO 2030%><option<%If Trim(I) = Trim(Year(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td></td>
-
</tr></table>
-
</td>
-
<td>
-
<table align="right" cellpadding="2" cellspacing="0" border="0"><tr>
-
<td>Expires Date:</td>
-
<td><select name="eM" id="eM"><%FOR I = 1 TO 12%><option<%If Trim(I) = Trim(Month(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td id="eD"><select name="eD" id="eD"><%FOR I = 1 TO 31%><option<%If Trim(I) = Trim(Day(Date)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td>/</td>
-
<td><select name="eY" id="eY"><%FOR I = 2001 TO 2030%><option<%If Trim(I) = Trim(Year(Date+365)) Then %> selected<%End If%> value="<%=I%>"><%=I%><%NEXT%></select></td>
-
<td></td>
-
</tr></table>
-
</td>
-
</tr></table>
-
-
</td>
-
</tr>
-
-
</td>
-
</tr><tr>
-
<td colspan="2" align="right"><br /><input type="Submit" value="Add Article" onClick="return ValidateNewsArticle()" /><br /></td>
-
</tr></table>
-
<input type="Hidden" name="mode" value="add" />
-
</form>
-
<br /><br />
-
</td>
-
</tr>
-
</table>
-
-
<!--#include file="inc_footer.asp"-->
Thanks so much, N
I tried the code and when i tried adding the article i got this error message. Remember before i could add the article , but there was no date in the fldCreated showing in the Mysql database Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'twoDay'
/Admin/ne_add.asp, line 19
and the code on line 19 is
Anyhow i think it important to mention something, this script was set to run on different databases, 1 for Access, 2 for MS sql and 3 for MySQL
It was working fine on Access. But i didn't show you the part for the Access database
You said " fldCreated" was missing. But it was also missing from the code used for Access, and it worked fine then. Let me show you, the complete code for that part, as i only showed you the MySQL one, -
'<description> add article </description>
-
'
-
IF DB_TO_USE = 1 THEN
-
SQL = "INSERT INTO nm_tbl_news (fldTITLE, fldCONTENT, fldSUMMARY, fldACTIVE, fldAID, fldPOSTED, fldEXPIRES, fldIMAGE, fldALLOW_COMMENTS, fldALLOW_VOTING, fldHIGHLIGHT, fldUSE_VIEW) VALUES ('" & TITLE & "','" & CONTENT & "','" & SUMMARY & "'," & ACTIVE & "," & AGENT & ",#" & sDATE & "#,#" & eDATE & "#,'" & IMAGE & "'," & ALLOW_C & "," & ALLOW_V & "," & HLITE & ", " & USE_VIEW & ")"
-
ELSE
-
SQL = "INSERT INTO nm_tbl_news (fldTITLE, fldCONTENT, fldSUMMARY, fldACTIVE, fldAID, fldPOSTED, fldEXPIRES, fldIMAGE, fldALLOW_COMMENTS, fldALLOW_VOTING, fldHIGHLIGHT, fldUSE_VIEW) VALUES ('" & TITLE & "','" & CONTENT & "','" & SUMMARY & "'," & ACTIVE & "," & AGENT & ",'" & sDATE & "','" & eDATE & "','" & IMAGE & "'," & ALLOW_C & "," & ALLOW_V & "," & HLITE & ", " & USE_VIEW & ")"
-
-
END IF
As you can see, fldCreated was missing from the Access one too. But the data that i transferred using Bullzip, shows the fldCreated field with dates in. The only ones showing "null" are the 4 articles i added since ive had MySQL
Anyway, using the code above, it didn't add the article to the database, but returned the error above.
I don't think this is related, but when i transferred the data, i couldn't transfer using Bullzip, without leaving out the "default" values, whatever those are. When i unchecked that box, i could transfer the data. I don't think that has anything to do with this, but just in case, i thought i'd let you know.
an update: I just checked my access database, and it didn't have a "fldCreated " column, so i'm confused now. Did the transfer create this extra column or what?
Many thanks
to solve the variable undefined errors, just create Dim statements for all teh variables I added to the top of the page, underneath the include statements.
See if that clears up the issue
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dominique Javet |
last post by:
Hello,
I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this
"newbie" question... I've found no answer in the forum ...
I've a date problem with my formular. In my mysql DB my filed "date" in
table "experience" is like this: Y-m-d (2002-07-23).
My fied`date` is date, NOT NULL with no default entry
My form read well the date data depending the id, (pe. 30.02.2003), but when
I submit a new date, I receive as result...
|
by: Jasper Bryant-Greene |
last post by:
I have a database of movie titles, with about 78,000 records, and a
database of related people (directors, writers, actors/actresses etc.)
with about 141,000 records. I display a random movie out of this
database on each hit to my website's homepage.
This worked fine when I had only a couple thousand movies, but now that
the DB has grown, it seems to be taking a bit longer to process the
page.
My DB schema for each table:
|
by: David Bordas |
last post by:
Hi list,
I've got a little bug with MySQL.
I can insert a row into my table but this row will not appear in the table
:(
Server is under linux redhat, MySQL is 3.23.56 installed from binary tar.gz
from MySQL team.
Table Description :
mysql> desc Log_Forums;
|
by: Mike Chirico |
last post by:
Interesting Things to Know about MySQL
Mike Chirico (mchirico@users.sourceforge.net)
Copyright (GPU Free Documentation License) 2004
Last Updated: Mon Jun 7 10:37:28 EDT 2004
The latest version of this document can be found at:
http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
|
by: Jeffrey D Moncrieff |
last post by:
I am trying to create a data base for colleting date for my research
project. I have run in to a couple of problems and I need it fast ASAP I
need it to be able to add data and edit them and view the data form a public
site. I have not use mysql and php since 2003 I have created the date base
with 2 tables 1 for a Jump Menu and on for the content. The contents is in
a table called PR and I as soon as I enter the data and hit submit the web...
| |
by: jlee |
last post by:
I'm pretty much a newbie on mysql, and I need some help.
I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4
(i386) on a server hosting an active website.
The site's developer uses his own php shopping cart to receive customer
orders.
The configuration was done via cPanel with no external modifications -
which produced no protests when built, ran and connected with no
|
by: Bucker |
last post by:
Could someone view the following that I copied from phpMyAdmin and tell
me
from the statistics if are server is running OK? Does it look like we
will have problems
as more people hit our server?
I'm not a db admin, so any help would be grateful.
Regards,
|
by: webandwe |
last post by:
Hi
The code below I took from a postgre file and convert it with a program to a mysql. Once i tried to import it to mysql it gave me an error and when i past in a php file to upload it trough a php file it stats I have loaded the information into the DB but i don't see any tables in the DB.
Here is the code as it comes from my plain *.txt file. Any suggestions?
CREATE TABLE categories (
record int(11) auto_increment NOT NULL,
...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |