Forum Moderators: coopster
And here is php code:
<?php
//establish connection to mysql
// check which button was clicked
// perform calculation
if ($_POST['Submit'])
{
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
//select the database
$db = "data";
mysql_select_db($db);
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS#"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_Place"];
$Comments = $_POST["Comments"];
//insert the values into the table
$result= MYSQL_QUERY("INSERT INTO users (Name, Address, SS#, Birthday, Birth_Place, Comments)".
"VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_place."','".$comments."')");
echo "Your Query was succesfully stored in the database :)";
mysql_close($conn);
}
else if ($_POST['Show All Records']) {
//displaying the database
//establish connection to mysql
$conn = mysql_connect("localhost","*****","*****") or die("Could not connect: " . mysql_error());
echo "Connected";
//select the database
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
$myrow = mysql_fetch_array($results);
//display the row
echo 'Your Query was succesfully stored in the database :)'
.''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_Place"].' <br> '.$myrow["Comments"].' <br>';
mysql_close($conn);
}
?>
Anybody, please help! This is my first php code and i'm stuck.
thanks
[edited by: coopster at 10:49 pm (utc) on Aug. 21, 2004]
[edit reason] generalized username and password [/edit]
$result= MYSQL_QUERY("INSERT INTO users (Name, Address, SS#, Birthday, Birth_Place, Comments)".
"VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_place."','".$comments."')");
to this:
$result= MYSQL_QUERY("INSERT INTO users (Name, Address, SS#, Birthday, Birth_Place, Comments) VALUES('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_place."','".$comments."')") or die(mysql_error());
As with your previous post, always use mysql_error().
I also remove the "." before values which doesn`t need to be there.
<?php
if ($Submit) {
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
//select the database
$db = "data";
mysql_select_db($db);
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS#"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_Place"];
$Comments = $_POST["Comments"];
//insert the values into the table
$result= MYSQL_QUERY("INSERT INTO users (Name, Address, SS#, Birthday, Birth_Place, Comments) VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_place."','".$comments."')") or die(mysql_error());
echo "Your Query was succesfully stored in the database :)";
mysql_close($conn);
}
if ($Show_All_Records) {
//displaying the database
$conn = mysql_connect("localhost","*****","*****") or die("Could not connect: " . mysql_error());
echo "Connected";
//select the database
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
$myrow = mysql_fetch_array($results);
//display the row
echo 'Your Query was succesfully stored in the database :)'
. ''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_Place"].' <br> '.$myrow["Comments"].' <br>';
mysql_close($conn);
}
?>
[edited by: jatar_k at 4:26 pm (utc) on Aug. 24, 2004]
$result= MYSQL_QUERY("INSERT INTO users (Name, Address, SS#, Birthday, Birth_place, comments)".
"VALUES ('$Name', '$Address', '$SS#', '$Birthday', '$Birth_place', '$comments')")or die(mysql_error());
I think i have a problem with MySql because even when i try to insert some records into the table working directly in MySql it won't let me store any new data and will give an error window saying the same thing:
You have an error in your SQL syntax near '' at line 1
Can you please advise on how to fix this problem.
Many thanks,
[edited by: jatar_k at 4:31 pm (utc) on Aug. 24, 2004]
You will also have to change this
$SS = $_POST["SS#"];
to this
$SS = $_POST["SS"];
After making those changes let me know how it works.
Just starting this "being helpful" thing so I would like to know how my suggestions are doing.
$query = "INSERT INTO users VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_Place."','".$comments."');
$result = mysql_query($query) or die (mysql_error());
Putting it all in mysql_query looked quite ugly and is prone to error.
In the original there is also no need for the concatentation operator between the "INSERT" and "VALUES", which is solved in my SQL above.
I also tried to change a string according to Buyurun's suggestion and now it does not give any error messages.
I assume it works! However, it won't print ANYTHING INSIDE THE WHILE LOOP OR AFTER IT.
Any suggestions? Thanks in advance,
Here is how the code looks now:
<?
//establish connection to mysql
// check which button was clicked
// perform calculation
if ($_POST['Submit'])
{
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
//select the database
$db = mysql_select_db("data");
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
//insert the values into the table
//$result= mysql_query("INSERT INTO users (Name, Address, SS#, Birthday, Birth_place, comments)
//VALUES ('$Name', '$Address', '$SS#', '$Birthday', '$Birth_place', '$comments')")or die(mysql_error());
$query = "INSERT INTO users VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_Place."','".$comments."')"or die(mysql_error());
echo "Your Query was succesfully stored in the database :)";
mysql_close($conn);
}
if ($_POST['Show_All_Records']) {
//establish connection to mysql
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
echo "Connected to MySql".'<br>'.'<br>';
//select the database
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
//display the results
print'Name:'.($_POST["Name"]).'<br>';
print'Address:'.($_POST["Address"]).'<br>';
print'SS#:'.($_POST["SS"]). '<br>';
print'Birthday:'.($_POST["Birthday"]). '<br>';
print'Place Of Birth:'.($_POST["Birth_place"]). '<br>';
print'Comments:'.($_POST["comments"]).'<br>'.'<br>';
//grabbing all data from the table
while ($r = mysql_fetch_array($result))
{
//the format is $variable = $r["nameofmysqlcolumn"];
$Name=$r["Name"];
$Address=$r["Address"];
$SS=$r["SS"];
$Birthday=$r["Birthday"];
$Birth_Place=$r["Birth_place"];
$Comments=$r["comments"];
}
echo 'Your Query was succesfully stored in the database :)'
.''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_place"].' <br> '.$myrow["comments"].' <br>';
mysql_close($conn);
}
?>
thanks,
Ruslan
[edited by: coopster at 9:34 pm (utc) on Aug. 23, 2004]
[edit reason] generalized username and password [/edit]
echo "$Name <br> $Address <br> $SS <br> $Birthday <br> $Birth_place <br> $Comments";
Also i put this inside the loop just to see if it eneters the loop but it still displays nothing.
Added this:
print'Name:'.($_POST["Name"]).'<br>';
Any advise please,
thanks,
Ruslan
Remove this.
//grabbing all data from the table
while ($r = mysql_fetch_array($result))
{
//the format is $variable = $r["nameofmysqlcolumn"];
$Name=$r["Name"];
$Address=$r["Address"];
$SS=$r["SS"];
$Birthday=$r["Birthday"];
$Birth_Place=$r["Birth_place"];
$Comments=$r["comments"];
}
Sub this out
//select the database
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
And Replace it with this
//select the database
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
$myrow = mysql_fetch_array($result);
Take this out.
echo 'Your Query was succesfully stored in the database :)'
.''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_place"].' <br> '.$myrow["comments"].' <br>';
And replace it with this.
echo 'Your Query was succesfully stored in the database :)';
echo ''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_place"].' <br> '.$myrow["comments"].' <br>';
When that is complete post your full code and I will go over it to make sure everything is correct.
If you get any errors post them as well.
[edited by: jatar_k at 4:47 pm (utc) on Aug. 24, 2004]
My database name is "data" and my table name is "tablename".
Any thoughts,
thanks
Ruslan
Connected to MySql
Your Query was succesfully stored in the database :)
Here is the php code:
<?
if ($_POST['Submit']) {
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
//select the database
$db = mysql_select_db("data") or die(mysql_error());
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
$query = "INSERT INTO users VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_Place."','".$comments."')"or die(mysql_error());
//$result = mysql_query($query) or die(mysql_error());
echo "Your Query was succesfully stored in the database :)";
mysql_close($conn);
}
if ($_POST['Show_All_Records']) {
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
echo "Connected to MySql".'<br>'.'<br>';
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
$myrow = mysql_fetch_array($result);
echo 'Your Query was succesfully stored in the database :)';
echo ''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_place"].' <br> '.$myrow["comments"].' <br>';
mysql_close($conn);
}
?>
[edited by: jatar_k at 4:41 pm (utc) on Aug. 24, 2004]
<?
if ($Submit) {
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
//select the database
$db = mysql_select_db("data");
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
$query = "INSERT INTO users VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_Place."','".$comments."')"or die(mysql_error());
echo "Your Query was succesfully stored in the database :)";
mysql_close($conn);
}
if ($Show_All_Records) {
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
echo "Connected to MySql".'<br>'.'<br>';
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
//display the results
print'Name:'.($_POST["Name"]).'<br>';
print'Address:'.($_POST["Address"]).'<br>';
print'SS#:'.($_POST["SS"]). '<br>';
print'Birthday:'.($_POST["Birthday"]). '<br>';
print'Place Of Birth:'.($_POST["Birth_place"]). '<br>';
print'Comments:'.($_POST["comments"]).'<br>'.'<br>';
//grabbing all data from the table
echo 'Your Query was succesfully stored in the database :)';
while ($myrow = mysql_fetch_array($result)) {
echo ''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_Place"].' <br> '.$myrow["Comments"].' <br>';
}
mysql_close($conn);
}
?>
Also I am assuming you would like to display the input from the user and the entire database, is this correct?
[edited by: jatar_k at 4:49 pm (utc) on Aug. 24, 2004]
Your Query was succesfully stored in the database :)Ruslan
Clement st.
999999999
03/22/1977
Us
No
This is the first row of info that is stored in my database manually. But the Info i entered in the form is not dispalyed. Aslo The second row in the database is not displayed.
thanks,
Ruslan
[edited by: coopster at 9:37 pm (utc) on Aug. 23, 2004]
[edit reason] generalized information [/edit]
try this
<?
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
if ($Submit) {
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
//select the database
$db = mysql_select_db("data");
$query = "INSERT INTO users VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_Place."','".$comments."')"or die(mysql_error());
echo "Your Query was succesfully stored in the database :)";
mysql_close($conn);
}
if ($Show_All_Records) {
//establish connection to mysql
$conn = mysql_connect("localhost","*****","*****") or
die("Could not connect: " . mysql_error());
echo "Connected to MySql".'<br>'.'<br>';
//select the database
$db = mysql_select_db("data");
$result = mysql_query("SELECT * FROM 'tablename'",$conn);
//display the results
echo 'Name:', $Name ,'<br>'
. 'Address:', $Address ,'<br>'
. 'SS#:', $SS ,'<br>'
. 'Birthday:', $Birthday ,'<br>'
. 'Place Of Birth:', $Birth_place ,'<br>'
. 'Comments:', $Comments ,'<br>'.'<br>';
//grabbing all data from the table
echo 'Your Query was succesfully stored in the database :)';
while ($myrow = mysql_fetch_array($result)) {
echo ''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_Place"].' <br> '.$myrow["Comments"].' <br>';
}
mysql_close($conn);
}
?>
[edited by: jatar_k at 4:43 pm (utc) on Aug. 24, 2004]
Your Query was succesfully stored in the database :)
Ruslan
Clement st.
999999999
03/22/1977
Us
No
it seems to me it does not put values submitted into a database. Or maybe when connection to database established the second time, when "show all records" pushed, it accesses the original database.
I really appreciate your help on this, but i gotta go to work now and be back to try to finish this in about 11 hours.
Feel free to post your suggestions- i will test them out as soon as i get back.
Thanks again,
Ruslan
[edited by: coopster at 9:41 pm (utc) on Aug. 23, 2004]
[edit reason] generalized information [/edit]
I cannot test it so I rely solely on your feedback.
Try this, edit the database information.
<?
//establish connection to mysql
// check which button was clicked
// perform calculation
$dbHost = "localhost";
$dbUser = "username";
$dbPass = "password";
$dbName = "data";
//connect to the mysql server
$conn = @mysql_connect($dbHost, $dbUser, $dbPass);
//return success or failure of connection
if(!$conn)
{
//report error
echo "Could not connect to server";
exit;
}
//select the database
if(!@mysql_select_db($dbName))
{
//report error
echo "Could not select database";
exit;
}
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
//Start First If Statement
if ($Submit) {
//insert the values into the table
//$result= mysql_query("INSERT INTO users (Name, Address, SS#, Birthday, Birth_place, comments)
//VALUES ('$Name', '$Address', '$SS#', '$Birthday', '$Birth_place', '$comments')")or die(mysql_error());
$query = "INSERT INTO users (Name, Address, SS, Birthday, Birth_place, comments) VALUES ('".$Name."','".$Address."','".$SS."','".$Birthday."','".$Birth_Place."','".$comments."')"or die(mysql_error());
echo "Your Query was succesfully stored in the database :)";
}
//End First if statement
//Start 2nd if statement
if ($Show_All_Records) {
//Select from Database
$result = mysql_query("SELECT * FROM 'users'",$conn);
//display the results
echo 'Name:', $Name ,'<br>'
. 'Address:', $Address ,'<br>'
. 'SS#:', $SS ,'<br>'
. 'Birthday:', $Birthday ,'<br>'
. 'Place Of Birth:', $Birth_place ,'<br>'
. 'Comments:', $Comments ,'<br>'.'<br>';
//grabbing all data from the table
echo 'Your Query was succesfully stored in the database :)';
//Start loop.
while ($myrow = mysql_fetch_array($result)) {
echo ''.$myrow["Name"].' <br> '.$myrow["Address"].' <br> '.$myrow["SS"].' <br> '.$myrow["Birthday"].' <br> '.$myrow["Birth_Place"].' <br> '.$myrow["Comments"].' <br>';
}
//End Loop
}
//End 2nd If Statement
mysql_close($conn);
?>
[edited by: jatar_k at 4:45 pm (utc) on Aug. 24, 2004]
Here is my code now (it is very different now):
<?php
$conn = mysql_connect("localhost","user","pass") or
die("Could not connect: " . mysql_error());
$db = mysql_select_db("data") or die(mysql_error());
//store all inputs into variables
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
//insert the values into the table
$result=mysql_query("INSERT INTO tablename VALUES ('$Name', '$Address', '$SS', '$Birthday', '$Birth_place', '$comments')");
//start first if statement
if ($_POST['Submit']) {
echo "Your Query was succesfully stored in the database :)";
}
if ($_POST['Show_All_Records']) {
//select the database
$db = mysql_select_db("data");
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
$myrow = mysql_fetch_array($result);
//display the results
print'Name:'.($_POST["Name"]).'<br>';
print'Address:'.($_POST["Address"]).'<br>';
print'SS#:'.($_POST["SS"]). '<br>';
print'Birthday:'.($_POST["Birthday"]). '<br>';
print'Place Of Birth:'.($_POST["Birth_place"]). '<br>';
print'Comments:'.($_POST["comments"]).'<br>'.'<br>';
echo 'Your Query was succesfully stored in the database :)'.'<br>'.'<br>';
echo "<p>",$myrow['Name'],":",
$myrow['Address'],
$myrow['SS'],
$myrow['Birthday'],
$myrow['Birth_place'],
$myrow['comments'] ;
mysql_close($conn);
}
?>
Hate to torture you, but any thoughts?
thanks,
ruslan
[edited by: jatar_k at 4:51 pm (utc) on Aug. 24, 2004]
<?php
// db connect
$conn = mysql_connect("localhost","user","pass") or
die("Could not connect: " . mysql_error());
$db = mysql_select_db("data") or die(mysql_error());
all of the above is just fine, we should now be connected to mysql.
Alright here's where it looks like thing start to go awry. First thing we need to look at is that we have 2 seperate jobs we want this script to do. Both of these need mysql connected so we can leave the above mysql_connect outside of our condition. For the rest the code will need to have 2 optional chunks of code therefore we go with an if else if since I don't know if you have some default for the script other than what I see in this post.
our base sctructure for the entire script will be
if ($_POST['Submit']) {
// Section A
} else if ($_POST['Show_All_Records']) {
// Section B
}
Section A - insert user data
Now, we need to do the following things in this section of code
1. acquire the data that the user submitted
2. construct our mysql query
3. execute our query and confirm that it succeeded
Your first part is fine but I would probably test the submitted data to see if required fields are missing and that the values are within the desired range. We can leave that for another day though.
//store all inputs into variables
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
I like to do this in seperate lines to aid in debugging. Building my query into a variable and then use that variable in the mysql_query. This allows me to echo the constructed query if need be. While I am developing queries and any other db stuff I also use or die statements on everything sent to mysql, otherwise you don't get the actual error from mysql and you can't possibly debug it. After the query is sent we then test for success.
$sql = "INSERT INTO tablename VALUES ";
$sql .= "('$Name', '$Address', '$SS', '$Birthday', '$Birth_place', '$comments')";
$result=mysql_query($sql) or die(mysql_error());
if (!$result) echo "no insert";
else echo "insert succeeded";
Section B - show all records
Now we are already connected to mysql and have selected the proper db so we are ready to roll. For this section of code we need to
1. construct our query
2. execute our query
3. display the returned results
your construct and execute look good.
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
we will do some straight forward tests for returned data and see if we can't loop through the rows. We can use mysql_num_rows to see how many rows were returned. If it is more than 0 then we need to reset the internal row pointer of the resource identifier otherwise our loop won't work. We test for 0 rows returned because then nothing needs to be done.
$howmany = mysql_num_rows($result);
echo "<p>Your query returned $howmany rows";
if ($howmany > 0) {
mysql_data_seek($result,0);
while($myrow = mysql_fetch_array($result)) {
echo "<p>",$myrow['Name'];
echo "<br>",$myrow['Address'];
echo "<br>",$myrow['SS'];
echo "<br>",$myrow['Birthday'];
echo "<br>",$myrow['Birth_place'];
echo "<br>",$myrow['comments'];
}
}
and finally close the connection
mysql_close($conn);
Now let's see if all that works, here's the complete code
<?php
$conn = mysql_connect("localhost","user","pass") or
die("Could not connect: " . mysql_error());
$db = mysql_select_db("data") or die(mysql_error());
if ($_POST['Submit']) {
$Name = $_POST["Name"];
$Address = $_POST["Address"];
$SS = $_POST["SS"];
$Birthday = $_POST["Birthday"];
$Birth_Place = $_POST["Birth_place"];
$Comments = $_POST["comments"];
$sql = "INSERT INTO tablename VALUES ";
$sql .= "('$Name', '$Address', '$SS', '$Birthday', '$Birth_place', '$comments')";
$result=mysql_query($sql) or die(mysql_error());
if (!$result) echo "no insert";
else echo "insert succeeded";
} else if ($_POST['Show_All_Records']) {
$sql = "SELECT * FROM `tablename`";
$result = mysql_query($sql) or die(mysql_error());
$howmany = mysql_num_rows($result);
echo "<p>Your query returned $howmany rows";
if ($howmany > 0) {
mysql_data_seek($result,0);
while($myrow = mysql_fetch_array($result)) {
echo "<p>",$myrow['Name'];
echo "<br>",$myrow['Address'];
echo "<br>",$myrow['SS'];
echo "<br>",$myrow['Birthday'];
echo "<br>",$myrow['Birth_place'];
echo "<br>",$myrow['comments'];
}
}
}
?>
I split some things to 2 lines so we wouldn't get sidescroll on this thread but it won't make a difference.
I changed it to this:
$Birth_place = $_POST["Birth_place"];
$comments = $_POST["comments"];
Everything works now,
thanks a lot jatar_k and dkin for your contribution,
Ruslan