Jump to content

Recommended Posts

I am trying to create a simple edit script, which means the user contribution should be editable by simply clicking edit and having the contribution printed out in between the textarea tags, so it is inside the textarea.

 

The problem I am having is that the assoc result is not set (I am checking with isset) in the following script, though I need the result to get the contribution and the description of it.

 

Here's the script so far:

 

<?php

if((isset($user_id)) && isset($_GET['con_title'])) {
    $con_title = $_GET['con_title'];

$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

$query_get = 'SELECT contribution, description FROM con WHERE user_id = "{' . $user_id . '}" AND name = "{' . $con_title . '}"';

$query_run = mysqli_query($connection, $query_get) or mysqli_error($connection);

$assoc = mysqli_fetch_assoc($query_run) or mysqli_error($connection);

$edit_description = $assoc['description'];
$edit_contribution = $assoc['contribution'];

echo ' edit desc: ' . $edit_description;
echo ' user id: ' . $user_id;
echo ' con title: ' . $con_title;
echo ' assoc: ' . $edit_contribution;

mysqli_close($connection);
}



?>

 

When I print out the edit_description and the edit_contribution variable I get empty space.

 

Any ideas and suggestions why it is not set? I am also not getting any error messages.

Link to comment
https://forums.phpfreaks.com/topic/252908-mysqli_fetch_assoc-result-empty/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.