I'm trying to insert some data into a database, I have the following code which is connecting to the database but not inserting any results (just empty rows).
I know the below code doesn't work, I've just tried to explain in PHP what I want. The issue is with the data being held in an array such as $tweet['created_at'] and I need this in a variable format so I can insert it into the database.
Any help is greatly appreciated, thank you!!
if ($_GET) {
$conn = mysql_connect('localhost', 'user', 'pass')
or die (mysql_error());
$tweet['created_at']=$tweet_created_at;
$tweet['text']=$tweet_text;
$tweet['location']=$tweet_location;
$tweet['followers_count']=$tweet_followers_count;
$tweet['sentiment']=$tweet_sentiment;
mysql_select_db("db") or die(mysql_error());
mysql_query("INSERT INTO table (Created_at, Tweet, Location, Number_of_Followers, Semantic_Result) VALUES ('$tweet_created_at', '$tweet_text', '$tweet_location', '$tweet_followers_count', '$tweet_sentiment')", $dbconnect);
}