I know this is an AI2 forum and not a PHP forum. But I think the question I have is more of an AI2 issue. I have:
⦁ MSSQL database (sqlexpress)
⦁ PHP 5.6.25
⦁ MIT AI2
I can connect to the database and run the query and INSERT static data. I need to be able to extract data from AI2 app that users SUBMIT. I don't need to send the entire QUERY, just the user data. My question is how do I send and then extract data from an AI2 app to a PHP script?
I know this is not secure, I'm just trying to get it to work.
I've attached the blocks and here is the PHP script:
<?php
$serverName = "server\sqlexpress";
$connectionInfo = array( "Database"=>"secondOne", "UID"=>"major1", "PWD"=>"payn32");
$SQLKEY="secret";
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connected OK10.";
}else{
echo "Connection fail.<br />";
die( print_r( sqlsrv_errors(), true));
}
$first = ($conn, $_POST['name']);
$second = ($conn, $_POST['age']);
$sql = "INSERT INTO tble12 (first, second) VALUES (?, ?)";
$params = array($first,$second);
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
?>
What happens if you run your app?
Does it work or do you get an error message?
If it works, then you did not need to ask the question. So I assume it does not work.
What was the error message, or what were the symptoms of it not working?
Does it work or do you get an error message?
If it works, then you did not need to ask the question. So I assume it does not work.
What was the error message, or what were the symptoms of it not working?
--
When submitted, NULL is INSERTED into the database. Which means it's not extracting the submitted data. I don't get an error message - as the query is run and completed. I just don't get any data inserted.
--
it seems to be, you forgot to urldecode your values in the php script
--
you might want to compare with the MySQL solution here http://puravidaapps.com/ mysql.php
mysql.aia
mysql.php
mysql.aia
mysql.php
$query=urldecode($_POST[' query']);
--
댓글 없음:
댓글 쓰기