PDA

View Full Version : Detecting database columns with DMX


Lance Ng
01-04-2004, 11:35
Has anyone tried using DMX's Insert Record Form to detect a MySQL database table's column on a remote server?

I'm able to connect and retrieve my records successfully but DMX is simply unable to detect the columns in the table for me to use the Insert Record function. I'm developing my website on a local PC and doing the testing server on a remote web host. Am I missing something here. Someone pls pls pls help!


Lance

dennis
01-04-2004, 20:44
insert only does insert... where got detect one? :bangwall: make sure ur database connection (using your script) works.

hurhur
02-04-2004, 00:55
getting field name? is that what you are trying to say?


Has anyone tried using DMX's Insert Record Form to detect a MySQL database table's column on a remote server?

I'm able to connect and retrieve my records successfully but DMX is simply unable to detect the columns in the table for me to use the Insert Record function. I'm developing my website on a local PC and doing the testing server on a remote web host. Am I missing something here. Someone pls pls pls help!


Lance

Sghost
02-04-2004, 14:51
Select * From 'tablename'

dennis
02-04-2004, 15:36
Select * From 'tablename'


dat will only shows all the rows (not fieldnames) in that table.

in oracle, there's a command that list the fieldnames and datatype (using Describe)

not sure for mysql what u can use.

dennis
02-04-2004, 15:38
Lance Ng, if u already knew the column field names in that table, do this :

INSERT INTO tablename (fieldname1,fieldname2,fieldname3 ... and so forth) VALUES (valuesforfieldname1,valuesforfieldname2,valuesfor fieldname3 ... and so forth)

Lance Ng
03-04-2004, 14:07
Thanks folks for the help!

I don't know scripting nor sql so was hoping to use Dreamweaver's automated Insert Record Form function to create a form. It has a script inside its config file to detect the fields of a database for this function. It is crucial to this function that the fields in the database is picked up by dreamweaver. Unfortunately I don't know scripting so can't figure out if it is written properly.

Does anyone have a ready script for a PHP form to insert records into MySql database I could use? I can configure the database connection and field names myself. Basically I am trying to create a form to insert records into a MySQL table managed by PhpMyAdmin.

Thanks all!

dennis
03-04-2004, 23:27
Thanks folks for the help!

I don't know scripting nor sql so was hoping to use Dreamweaver's automated Insert Record Form function to create a form. It has a script inside its config file to detect the fields of a database for this function. It is crucial to this function that the fields in the database is picked up by dreamweaver. Unfortunately I don't know scripting so can't figure out if it is written properly.

Does anyone have a ready script for a PHP form to insert records into MySql database I could use? I can configure the database connection and field names myself. Basically I am trying to create a form to insert records into a MySQL table managed by PhpMyAdmin.

Thanks all!

do some readup here :

http://sg2.php.net/mysql

once again i repeat. mysql 'INSERT' command does not detect fieldnames of a database!

INSERT like what it says, simply inserts a record into the table.

Hope i have corrected you. Cos you are making us confused by what u actually wants.

and dun use DMX to code in php if u are not familiar with php, it will get you more confused. Read up the site i posted above, then try to code it using DMX.

fred
04-04-2004, 00:34
1. connect to your database

<?php
$db_user = 'prefix_username';
$db_pass = 'password';
$db_host = 'localhost'; //Usually "localhost"
$db_name = 'prefix_databasename';

$con= @mysql_connect("$db_host","$db_user","$db_pass")
or die ("Cannot connect to MySQL.");

$db = @mysql_select_db("$db_name",$con)
or die ("Cannot select the $db_name database. Please check your details in the database connection file and try again");
?>


2. insert into your table

$sqlString = "INSERT INTO table_name(field1,field2) VALUES(value1,value2) WHERE field3=condition;
mysql_query($sqlString);


This is just a sample, i would suggest your to spend some time on the php manual first. It is rather simple to use php, good luck to you :-)

Sghost
10-04-2004, 12:26
Yes I agree with Fred , take sometimes to read the php manual.

phpmad
27-09-2004, 12:04
Hi Lance,
If I not getting your message wrongly, what I believe is that your server host which is probably your web hosting company does not allow you to connect directly to their database IP. You may be able to connect locally on your own pc but not at the remote server because they block access from external applications.

What you should do is this. When creating DMX, your remote and local site server host should put 'localhost' and the database name, username and password set to be the same.



Hope this helps..