Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEED ASP CODE

Status
Not open for further replies.

LinuxGuy

Programmer
Nov 18, 2002
37
0
0
US
i need Some example Code in getting My feilds into an MySQL database,, web links ??
 
Are you looking for ASP code? I think you got the wrong forum. Go to ASP forum.
 
who wants to script something in asp ?? try php once and you never want to use asp again ;)
 
what do u neeed? an insert code?
Code:
<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%> 
<%
Dim MM_MYSQL_STRING
MM_MYSQL_STRING = &quot;driver={MySQL ODBC 3.51 Driver}; database=DB_NAME;server=server_NAME;uid=user;pwd=pass;option=16386;&quot;
%>
<%
if(Request.Form(&quot;tfUSERNAME&quot;) <> &quot;&quot;) then Command1__varUser = Request.Form(&quot;tfUSERNAME&quot;)
if(Request.Form(&quot;tfNAME&quot;) <> &quot;&quot;) then Command1__varName = Request.Form(&quot;tfNAME&quot;)
%>
<%

set Command1 = Server.CreateObject(&quot;ADODB.Command&quot;)
Command1.ActiveConnection = MM_MYSQL_STRING
Command1.CommandText = &quot;INSERT INTO database_name.table_name(Field1,Field2)  VALUES ('&quot; + Replace(Command1__varUser, &quot;'&quot;, &quot;''&quot;) + &quot;','&quot; + Replace(Command1__varName, &quot;'&quot;, &quot;''&quot;) + &quot;') &quot;
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
set Command1= Nothing
%>
<html>
<head>
<title>MySQL Insert </title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<form action=&quot;MySQL1.asp&quot; name=&quot;form1&quot;>
  <p>UserName: 
    <input name=&quot;tfUSERNAME&quot; type=&quot;text&quot; id=&quot;tfUSERNAME&quot;>
  </p>
  <p>Name: 
    <input name=&quot;tfNAME&quot; type=&quot;text&quot; id=&quot;tfNAME&quot;>
  </p>
  <p> 
    <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
    <input type=&quot;reset&quot; name=&quot;Submit2&quot; value=&quot;Reset&quot;>
  </p>
</form>
</body>
</html>

insertion of two fields into one table using 1 ASP page
All the best!

> need more info?
:: don't click HERE ::
 
&quot;so you need all that code!!!???&quot;
--> I am not looking to start a thread on ASP vs. PHP

ALL the code above is not necessary to perform an acutal SQL insert
anyhow.....take it or leave it!

> need more info?
:: don't click HERE ::
 
Chacalinc:
Play nice. Once you remove all the extraneous openings and closings of the ASP tags and then convert the script to equivalent PHP, the PHP script only around 6 lines shorter. And most of that's probably fixed overhead that would not scale for a longer script.

Anyway, you missed the central issue. The reason to choose PHP over ASP when using MySQL is that PHP uses MySQL-native communications libraries, versus ASP and ODBC. The ODBC subsystem can really slow down database access.



Want the best answers? Ask the best questions: TANSTAAFL!!
 
I agree with you sleipnir, reviewing the code, it's not too much different.

In addition, as i said to lebisol, I don't want to start a thread on ASP vs. PHP. But, that I love of PHP is portability betweend servers (Win/Ux).

Talking about this... how is the comuncation between PHP and Oracle? via ODBC or like with MySQL?

(sorry for use this thread, but this will be the only question).
 
:) it is all good!
I am bit tired of posts this vs. that.....but what the sleipnir214 pointed out is where it all matters (besides the DB design skills)
ODBC was never really intened to be used on the web sooo as said performance sufferes in this combo

The way I see it...it depends on the project and &quot;customers&quot;
I agree that PHP + MySQL is the way to go...
All the best!

> need more info?
:: don't click HERE ::
 
Chacalinc:
PHP can use native communications libraries to communicate with the DB++, FrontBase, Informix, Interbase, Ingres II, SQL Server, mSQL, MySQL, Oracle, and PostgreSQL database servers. Outside of that, you have to use ODBC.

Keep in mind, however, that a lot of the libraries aren't bundled with PHP because they are proprietary.


Want the best answers? Ask the best questions: TANSTAAFL!!
 
oh yes, I agree with you lebisol with &quot;depend&quot;... in fact, it's not clever to use Oracle with PHP if you have IAS.

My question is not pointing out whether PHP or ASP is better with Oracle, just curious about PHP with Oracle. If I want to do something with Oracle in Web environment, I will use IAS, and client/server it could be better VB or some Visual...

Cheers.
 
IAS=Internet Application Server... from Oracle Corp.

It's funny, the core is Apache and Java, but they are optimized to work with Oracle DB (of course) and a lots of things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top