Problem with Insert data.
Posted: Thu Mar 22, 2007 2:21 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I figured it might have something to do with the space in the name so i tried to use text as the field for unitname. I can insert other $string just fine, or just plain text. However it will not input the unitname from the $tring when i try this code. any ideas?
Thanks,
NickCode: Select all
<?php
$ini = parse_ini_file('Aloha.ini');
$unitname=$ini['UNITNAME'];
$connection=mysql_connect("localhost","tech303_bec","password") or die("Could not connect to the database server");
$db= mysql_select_db("tech303_bec",$connection) or die ("Unable to select database.");
$sql="INSERT INTO customer (unitname) VALUES ('$unitname')";
mysql_query($sql,$connection) or die ('Could not insert data');
echo('Data inserted successfully.');
mysql_close($connection);
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]