TutorialMS Community Forum

Full Version: Adding 'Description' at tutorial_bit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have tried doing these things in order to have another 'Description' for the tutorials, other than just Category, Source and date added.
1) Added new column at mySQL database (called as 'tutdescription)
2) Changed these (line 54-56 in submit2.php)
Code:
    $title = $_POST['title'];
    $tutorialurl = $_POST['tutorialurl'];
    $validate = validate_submit($weburl, $number, $cat);
to these :
Code:
    $title = $_POST['title'];
    $tutdescription = $_POST['tutdescription']
    $tutorialurl = $_POST['tutorialurl'];
    $validate = validate_submit($weburl, $number, $cat);
3) To avoid more 'problems', I didn't make the script to validate it (I've tried doing it, but no success).
4) I have also changed these (line 712 in \includes\classes\tutorial.php)
Code:
        mysql_query("INSERT INTO `tutorial_front`(`tutname`, `source`, `mcate`, `link`, `date`) VALUES('".addslashes($title)."', '".Format_Sourcesite($source)."', '".$cat."', '".$url."', '".time()."')");
to these :
Code:
        mysql_query("INSERT INTO `tutorial_front`(`tutname`, `tutdescription`, `source`, `mcate`, `link`, `date`) VALUES('".addslashes($title)."', '".$tutdescription."', '".Format_Sourcesite($source)."', '".$cat."', '".$url."', '".time()."')");
5) Added these in submit_tutorial_bit
Code:
                Please enter a brief description about your tutorial: (Max 100 characters)
                <br />
                <input name="tutdescription[$submit_tutorial_bit[number]]" maxlength="100" size="60" type="text" class="form_styles">
                <br /><br />

However, I just get 'submission fail' when I try to submit tutorials. So, can anyone tell me which part am I doing wrong / missed?

Thanks.

Edit : I have also added few more lines at tutorial_bit to 'call' the description from the database, but this is not relevant as now it can't even submit.
Hi. Everything looks proper except one area that stands out with me:

Quote:"4) I have also changed these (line 712 in \includes\classes\tutorial.php)"
Code:
mysql_query("INSERT INTO `tutorial_front`(`tutname`, `tutdescription`, `source`, `mcate`, `link`, `date`) VALUES('".addslashes($title)."', '".$tutdescription."', '".Format_Sourcesite($source)."', '".$cat."', '".$url."', '".time()."')");
I would suggest changing the above to:
Code:
mysql_query("INSERT INTO `tutorial_front`(`tutname`, `tutdescription`, `source`, `mcate`, `link`, `date`) VALUES('".addslashes($title)."', '".$tutdesc."', '".Format_Sourcesite($source)."', '".$cat."', '".$url."', '".time()."')");
Then a couple lines up in the same "tutorial.php" file find:
Code:
function validate_tutorial($title, $url, $source, $cat) {
Change it to:
Code:
function validate_tutorial($title, $tutdesc, $url, $source, $cat) {
Next, in submit2.php find:
Code:
$title = $_POST['title'];
   $tutdescription = $_POST['tutdescription']
   $tutorialurl = $_POST['tutorialurl'];
   $validate = validate_submit($weburl, $number, $cat);
and change to:
Code:
$title = $_POST['title'];
   $tutdesc = $_POST['tutdescription']
   $tutorialurl = $_POST['tutorialurl'];
   $validate = validate_submit($weburl, $number, $cat);
I might be wrong in this, but I think the description needed to be defined in the function in order to be recognized. I also changed the name of the function from "tutdescription" to "tutdesc" for easier reference and less confusion.

See if that works. Hope this helps.
Thanks for the reply...actually my previous code works. The problem is, I just used the same URL for the tutorial and that caused my submission 'fail'. Now I've used another URL and it works. Anyway, thanks for your reply Smile
Now I have tried to add 'Description' at 'Write' but it doesn't work. I will get 'The selected category does not exist' when I submit it. Here's what I did :
1) Added these at 'write' :
Code:
                Please enter a brief description about your tutorial: (Max 100 characters)
                <br />
                <input name="tutorial_description" maxlength="100" size="60" type="text" class="form_styles">
                <br /><br />
2) Changed these (line 90, global.php)
Code:
        if(!isset($_POST['tutorial_title']) || !isset($_POST['tutorial_description']) || !isset($_POST['tutorialtext']) || $_POST['tutorial_title'] == '' || $_POST['tutorialtext'] == '') {
To these :
Code:
        if(!isset($_POST['tutorial_title']) || !isset($_POST['tutorialtext']) || $_POST['tutorial_title'] == '' || $_POST['tutorial_description'] == '' || $_POST['tutorialtext'] == '') {
3) Also changed these (line 100, global.php)
Code:
            $glob['write_result'] = write_tutorial($_POST['tutorial_title'], $_POST['tutorialtext'], $_GET['cat'], $_POST['noavatar'], $_FILES['tutorial_avatar']);
To these :
Code:
            $glob['write_result'] = write_tutorial($_POST['tutorial_title'], $_POST['tutorial_description'] $_POST['tutorialtext'], $_GET['cat'], $_POST['noavatar'], $_FILES['tutorial_avatar']);

Anyone can tell me which part went wrong? Besides, if possible, I would like to make the preview function properly. Right now, if I click preview, the 'description' will disappear but other informations are still there.

Thanks for your help and have a nice day.
I have edited few lines in user.php as well, and now the 'preview' will work but there's still 1 thing that puzzles me, which is, why will I get "The selected category does not exist." when I try to write and submit a tutorial?

Thanks.
Can anyone tell me why will I get that error message? From my 'observation', it seems that these few lines are causing that problem (line 283 - 286 at users.php)
Code:
    $num_rows = mysql_num_rows(mysql_query("SELECT * FROM `navigation` WHERE `id`='".check_slashes($cat)."'"));
    if($num_rows == 0) {
        $error .= 'The selected category does not exist.<br />';
    }

Any suggestion / solution?

Thanks for your help.
Reference URL's