Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

FCK Editor + MYSQL Database

Options
2»

Comments

  • Registered Users Posts: 287 ✭✭Keewee6


        </span><?php GetSQLValueString($_POST, "text"), ?>;


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Keewee6 wrote: »
        </span><?php GetSQLValueString($_POST, "text"), ?>;

    Looking at this the Tags should not be there
    Will you show us code block from lines 25 to 35 please


  • Registered Users Posts: 287 ✭✭Keewee6


    Looking at this the Tags should not be there
    Will you show us code block from lines 25 to 35 please

    <tr>
    <td height="38" colspan="3"><!--DWLayoutEmptyCell--> </td>
    </tr>
    <tr>
    <td height="379" colspan="3" valign="top" bgcolor="#006666"> <p align="left"><span class="sqstyle">
        </span><?php GetSQLValueString($_POST, "text"), ?>;
    <form action="addevent.php" method="post" name="form" id="form">
    <table width="462" align="center">
    <tr>
    <td colspan="2">Event: <?php
    $oFCKeditor = new FCKeditor('Keewee6') ;


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Keewee6 wrote: »
    <tr>
    <td height="38" colspan="3"><!--DWLayoutEmptyCell--> </td>
    </tr>
    <tr>
    <td height="379" colspan="3" valign="top" bgcolor="#006666"> <p align="left"><span class="sqstyle">
        </span><?php GetSQLValueString($_POST, "text"), ?>;
    <form action="addevent.php" method="post" name="form" id="form">
    <table width="462" align="center">
    <tr>
    <td colspan="2">Event: <?php
    $oFCKeditor = new FCKeditor('Keewee6') ;

    GetSQLValueString($_POST, "text"),
    this line is part of an SQL query. so will you show your sql...


  • Registered Users Posts: 287 ✭✭Keewee6


    ?php GetSQLValueString($_POST, "text"), ?>; this line is part of an SQL query. so will you show your sql...

    ahh seem to be a query oops


  • Advertisement
  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Keewee6 wrote: »
    ahh seem to be a query oops

    Will you show me your SQL.
    Block out you names except the field name where you want the editor, block like this *****


  • Registered Users Posts: 287 ✭✭Keewee6


    Will you show me your SQL.
    Block out you names except the field name where you want the editor, block like this *****

    $result = mysql_query("SELECT * FROM events")
    or die(mysql_error());


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Keewee6 wrote: »
    $result = mysql_query("SELECT * FROM events")
    or die(mysql_error());

    That's a SELECT query (Select all from events)

    What you need is the part of the page where you have a UPDATE or an INSERT query like this

    [PHP]INSERT INTO call_info (master_id, Call_Info, Date, Time, Caller_id) VALUES (%s, %s, %s, %s, %s)",
    GetSQLValueString($_POST, "int"),
    GetSQLValueString($_POST, "text"), // this was --GetSQLValueString($_POST, "text"),---
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "int"));[/PHP]


  • Registered Users Posts: 6,496 ✭✭✭daymobrew


    Keewee6 wrote: »
        </span><?php GetSQLValueString($_POST, "text"), ?>;
    There is a comma just before the closing '?>' tag - it should be a semi-colon.


  • Registered Users Posts: 287 ✭✭Keewee6


    <?php
    include_once("fckeditor/fckeditor.php") ;// this could be ckeditor/ckeditor.php
    ?>
    <html>
    <head>
    <title>The Square Bar & Nixys Lounge</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="sqstylesheet.css" rel="stylesheet" type="text/css">
    </head>

    <body bgcolor="#006666" text="#FFFFFF" link="#0000CC" topmargin="0" leftmargin="0">
    <table width="758" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr>
    <td width="286" height="157" valign="top"><!--DWLayoutEmptyCell--> </td>
    <td width="21" valign="top"><!--DWLayoutEmptyCell--> </td>
    <td width="451" valign="top"><!--DWLayoutEmptyCell--> </td>
    </tr>
    <tr>
    <td height="23" colspan="3"><!--DWLayoutEmptyCell--> </td>
    </tr>
    <tr>
    <td height="26" colspan="3" valign="top" class="sqstyle"><!--DWLayoutEmptyCell--> </td>
    </tr>
    <tr>
    <td height="38" colspan="3"><!--DWLayoutEmptyCell--> </td>
    </tr>
    <tr>
    <td height="379" colspan="3" valign="top" bgcolor="#006666"> <p align="left"><span class="sqstyle">
    <?
    // Make a MySQL Connection
    mysql_connect("localhost", "", "") or die(mysql_error());
    mysql_select_db("squarebar_db1") or die(mysql_error());

    // Get all the data from the "example" table

    INSERT INTO events (date, day, events) VALUES (%s, %s, %s, %s, %s)",

    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "int"));



    // keeps getting the next row until there are no more to get
    while($row = mysql_fetch_array( $result )) {
    // Print out the contents of each row into a table

    echo $row;
    ?>
        </span><?php GetSQLValueString($_POST, "text"); ?>;
    <form action="addevent.php" method="post" name="form" id="form">
    <table width="462" align="center">
    <tr>
    <td colspan="2">Event: <?php
    $oFCKeditor = new FCKeditor('Keewee6') ; // insert into the $_POST["FCKeditor1"] in the SQL Query at top of page
    $oFCKeditor->BasePath = 'fckeditor/' ;
    $oFCKeditor->ToolbarSet = 'EditOnly'; // 'CMS_Text_Update' or 'Default' or 'Basic' or 'EditOnly'
    $oFCKeditor->Height ='200'; // How to size
    $oFCKeditor->Width ='450'; // How to size
    $oFCKeditor->Value = 'what ever you want!' ; // Default text in data box on you html page
    $oFCKeditor->Create() ;
    ?> </td>
    </tr>
    <tr>
    <td width="64"> </td>
    <td width="386"> </td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td> </td>
    <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    </tr>
    </table>
    </form>
    <p align="center"><span class="sqstyle"> </span> </tr>
    <table width="400" border="1" align="center" cellspacing="1" bgcolor="#CCCCCC">
    <tr> </tr>
    </table>
    </table>
    </body>
    </html>
    getting this error
    Parse error: syntax error, unexpected T_STRING in /home/squarebar/domains/nixysthesquarebar.com/public_html/testcms.php on line 37


  • Advertisement
  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Setup your form so that it sends the information to the database successfully.

    Then show us the code of the working form...

    The code is missing the Date, Day input fields. If they are missing HOW are you adding information to a database.
    The SQL needs to know where to get the information. So you should have 3 fields Date, Day and Keewee6 (Keewee6 will have an editor).

    You did not change any of the code i gave you. You just pasted it.

    Hmmmmm


  • Registered Users Posts: 6,496 ✭✭✭daymobrew


    Keewee6 wrote: »
    getting this error
    Parse error: syntax error, unexpected T_STRING in /home/squarebar/domains/nixysthesquarebar.com/public_html/testcms.php on line 37
    [PHP]INSERT INTO events (date, day, events) VALUES (%s, %s, %s, %s, %s)",[/PHP] This is SQL string - it needs to be put into a PHP function call.


  • Registered Users Posts: 287 ✭✭Keewee6


    right got a form to work - now what


  • Registered Users Posts: 287 ✭✭Keewee6


    form code
    <form id="form1" name="form1" method="post" action="insert.php">
    <p><br />
    date :
    <input name="date" type="text" id="date" />
    <br />
    data
    <textarea name="data" cols="100" rows="20" id="data"></textarea>
    </p>
    <p>
    <input type="submit" name="Submit" value="Submit" />
    </p>
    </form>

    insert.php code
    <?php
    mysql_connect("localhost","user","pass");
    mysql_select_db("squarebar_db1");
    ;
    // Get values from form.
    $date=$_POST;
    $data=$_POST;


    // Insert all parameters into database.
    // The id field is auto increment. You don't have to insert any value
    mysql_query("insert into news(date, data) values('$date', '$data')");

    // Close database connection
    mysql_close();

    ?>


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Try this!
    If you done what i said with the downloading of the Editor files it should work for you.

    [PHP]
    <?php include_once("fckeditor/fckeditor.php") ; //added top of page ?>

    <form id="form1" name="form1" method="post" action="insert.php">
    <p><br />
    date :
    <input name="date" type="text" id="date" />
    <br />
    data
    <?php
    // I removed your data textbox because you no longer need it as the
    // fckeditor is taking that job, which will give you the textbox with an eitor
    $oFCKeditor = new FCKeditor('data') ; // I have changed the name to match the textbox name in you SQL, don't forget your SQL need to get the information from somewhere
    $oFCKeditor->BasePath = 'fckeditor/' ;
    $oFCKeditor->ToolbarSet = 'Default'; // 'Default' is the textbox salection in you editor files RTFM (Read the f*****g manual) for this.
    $oFCKeditor->Height ='200'; // How to size, change this as you wish
    $oFCKeditor->Width ='450'; // How to size, change this as you wish
    $oFCKeditor->Value = 'KeeWee change this text in the code view! And try to use <?php ?> and not <? ?>' ; // Default text in data box on you html page
    $oFCKeditor->Create() ;
    ?>
    </p>
    <p>
    <input type="submit" name="Submit" value="Submit" />
    </p>
    </form>

    insert.php code
    <?php
    mysql_connect("localhost","user","pass");
    mysql_select_db("squarebar_db1");
    ;
    // Get values from form.
    $date=$_POST;
    $data=$_POST;


    // Insert all parameters into database.
    // The id field is auto increment. You don't have to insert any value
    mysql_query("insert into news(date, data) values('$date', '$data')");

    // Close database connection
    mysql_close();

    ?> [/PHP]


  • Registered Users Posts: 287 ✭✭Keewee6


    yess at last thanks a mill-workin on an update page now


  • Registered Users Posts: 287 ✭✭Keewee6


    $oFCKeditor->Value = 'KeeWee change this text in the code view! And try to use <?php ?> and not <? ?>' ; // Default text in data box on you html page
    $oFCKeditor->Create() ;

    how do i pull the data into the editor to update it

    code


    <?
    // START PHP CODES. THIS PART MUST ON THE TOP OF THIS PAGE.

    // Connect database.
    mysql_connect("localhost", "user", "pass") or die(mysql_error());
    mysql_select_db("squarebar_db1") or die(mysql_error());

    // ***** This part will process when you Click on "Submit" button *****
    // Check, if you clicked "Submit" button
    if($_POST){

    // Get parameters from form.
    $data=$_POST;


    // Do update statement.
    mysql_query("update news set data='$data', where id='$id'");

    // Re-direct this page to select.php.
    header("location:select.php");
    exit;
    }
    // ************* End update part *************

    // *** Select data to show on text fields in form. ***

    // Get id parameter (GET method) from select.php
    $id=$_GET;

    // Get records in all columns from table where column id equal in $id and put it in $result.
    $result=mysql_query("select * from news where id='$id'");

    // Split records in $result by table rows and put them in $row.
    $row=mysql_fetch_assoc($result);

    // Close database connection.
    mysql_close();
    ?>

    <!-- END OF PHP CODES AND START HTML TAGS -->

    <html>
    <body>
    <!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
    <form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">
    <p>id :
    <!-- name of this text field is "name" -->
    <input name="id" type="text" id="id" value="<? echo $row; ?>"/>
    <br />
    day :
    <!-- name of this text field is "email" -->
    <input name="date" type="text" id="day" value="<? echo $row; ?>"/>
    <br />
    <?php
    // I removed your data textbox because you no longer need it as the
    // fckeditor is taking that job, which will give you the textbox with an eitor
    $oFCKeditor = new FCKeditor('data') ; // I have changed the name to match the textbox name in you SQL, don't forget your SQL need to get the information from somewhere
    $oFCKeditor->BasePath = 'fckeditor/' ;
    $oFCKeditor->ToolbarSet = 'Default'; // 'Default' is the textbox salection in you editor files RTFM (Read the f*****g manual) for this.
    $oFCKeditor->Height ='300'; // How to size, change this as you wish
    $oFCKeditor->Width ='700'; // How to size, change this as you wish
    $oFCKeditor->Value = 'KeeWee change this text in the code view! And try to use <?php ?> and not <? ?>' ; // Default text in data box on you html page
    $oFCKeditor->Create() ;
    ?>
    </p>
    <p>
    <input type="submit" name="Submit" value="Submit" />
    </p>
    </form>
    </body>
    </html>

    error
    Parse error: syntax error, unexpected T_STRING in /home/squarebar/domains/nixysthesquarebar.com/public_html/update.php on line 64


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Hi Keewee

    Delete this line:
    [PHP]$oFCKeditor->Value = 'KeeWee change this text in the code view! And try to use <?php ?> and not <? ?>' ; // Default text in data box on you html page[/PHP]

    Insert this line:
    [PHP]$oFCKeditor->Value = "{$row}"; // Should now show text from database [/PHP]

    Hope it helps.


  • Registered Users Posts: 287 ✭✭Keewee6


    getting there working on the actual update query now


Advertisement