Har ingen ide om hvorfor men det virker altså nu:
- $var= $_POST['to'];
- $text= $_POST['text'];
- $subject= $_POST['name'];
- $ownerid= $_SESSION['id'];
-
- // Creates Conversation:
-
- $result1 = "INSERT INTO pm__conversations (name, owner_id, created_at) VALUES ('$subject', '$ownerid', NOW())";
- $result1s = $conn->query($result1);
- $pmid = $conn->insert_id;
-
- // Creates Message:
-
- $result2 = "INSERT INTO pm__messages (conversation_id, message, userid, created_at) VALUES ('$pmid', '$text', '$ownerid', NOW())";
- $result2s = $conn->query($result2);
-
- // Add each user to Conversation:
-
- $pieces = explode(",", $var);
- foreach($pieces as $element)
- {
-
- $result3 = "INSERT INTO pm__conversation_user (conversation_id, user_id, created_at) VALUES ('$pmid', '$element', NOW())";
- if ($conn->query($result3) === TRUE) {
-
-
- header("location: ../messages.php?pmid=".$pmid."");
- }
- }
- $result4 = "INSERT INTO pm__conversation_user (conversation_id, user_id, created_at) VALUES ('$pmid', '$ownerid', NOW())";
- $result4s = $conn->query($result4);
Mange tak for hjælpen det hjalp ihvertfald videre
Indlæg senest redigeret d. 19.05.2016 09:36 af Bruger #21392