tweakmaster
03-27-2002, 05:07 AM
Hi all
I have looked at all(the ones I can find) script sites and I have been unable to find a script that puts form input straight into a mysql database, I am using windows2000 and I have noticed that there is a lot out there for *nix, but I have not been able to find any for win2000
If anyone knows of a php2mysql parser could you please help me with my dilema, the reason I need is to parse a signup page straight to mysql.
Thanks for any help
Tweakmaster
DaddyPops
03-27-2002, 05:34 AM
This is out of my head so I apologize for bugs
<%
Set dbconn = Server.CreateObject("ADODB.Connection")
dbconn.open "DSN", "DSNUser", "DSNPassword"
insert_sql = "insert into articles (ROWNAME1, ROWNAME2, ROWNAME3)"
insert_sql = insert_sql & " values ('" & VALUE1 & "','" & VALUE2 & "','" & VALUE3 & "')"
dbconn.execute(insert_sql)
%>
Also please note the seperation of the values is like this since it is hard to read.
<doublequote><singlequote><comma><singlequote><doublequote>
The reason for this is so that your single quotes needed for the sql statement are included into the asp variable.
Snow White
03-28-2002, 02:34 PM
You didn't say what scripts you were using with MySQL.
If you use PHP, which will run with Win servers too, it'll be really easy. I've done that before.
dbzgod
03-28-2002, 06:41 PM
Here is a sample code off the top of my head:
<?php
mysql_db_query ($dbname,"INSERT INTO dbtable_here (list your fields in your databse that you are going to insert informatio into) values ($name of form field)",$db) or die (mysql_error());
?>
A few notes:
$dbname is a variable found maybe in a config file
dbtable_here is the table that you will be inserting the information into
(list your fields in your databse that you are going to insert information into): IN this put the name of the fields in the table that you are going to be inserting an information into
($name of form field): Put a $ followed by the name of the form field. Be sure to align this with the part above that you are using
I know this probably does not make any sense. Sorry about that. If someone could please explain it to him in better terms.
Here is an example o how I use it:
<?php
mysql_db_query ($dbname,"Insert into top_user (sid,name,password,email,title,url,banner,bannerw,bannerh,description,category,status,country,linkback) values ('$sid','$name','$passw','$email','$title','$url','$banner_url',$banner_w,$banner_h,'$description',$category,'Y','$country','$linkback')",$db) or die (mysql_error());
?>