Jump to content

Aureole

Members
  • Posts

    788
  • Joined

  • Last visited

    Never

Everything posted by Aureole

  1. I don't see how there's anything wrong with that. ??? Enlighten me?
  2. 'Cause when I submit my form I get a white screen and nothing is getting added to the database. <?php if (isset($_POST['submitted'])) { include("http://www.veraci7y.net/connectme.php"); if (empty($_POST['title'])) { echo 'You did not enter a title.'; } else { $t = $_POST['title']; } $c = $_POST['category']; if (empty($_POST['shortstory'])) { echo 'You did not enter a short story.'; } else { $s = $_POST['shortstory']; } if (empty($_POST['fullstory'])) { echo 'You did not enter a full story.'; } else { $f = $_POST['fullstory']; } $a = $_POST['author']; $m = $_POST['memberid']; if ($t && $s && $f) { $query = "INSERT INTO news (title, category, shortstory, fullstory, author, memberid) VALUES ('$t', '$c', '$s', '$f', '$a', '$m')"; $result = @mysql_query($query); if ($result) { echo 'News posted successfully.'; } else { echo 'News could not be added.'; } } else { echo ' All fields are required.'; } } ?>
  3. Sorry for double post. Ok well that fixed that but now something strange is happening... At the bottom right of the page I am seeing: That's an Invision Power Board error and the thing is... 1) My Forum is working fine... 2) My site is connected to my forum in ways like the latest posts are shown on the site and I am using the IPB SDK but they are both working fine so why is there an error. ALSO the error has some style information associated with it so it's messing with my font sizes making everything small. ??? http://www.veraci7y.net/index.php just in case.
  4. I'm getting that error for some reason unknown to me...here's my code. <?php $h='localhost'; $u='Username'; $p='Password'; $conn = mysql_connect($h, $u, $p) or die("mysql_connect() - Failure!<br />"); print "mysql_connect() - Success!<br />"; $which = mysql_select_db(veraci7y_website) or die("mysql_select_db() - Failure!<br />"); print "mysql_select_db() - Success!<br />"; $select = mysql_query("SELECT * FROM news") or die ("mysql_query() - Failure!<br />"); print "mysql_query() - Success!<br />"); while($row = mysql_fetch_array($result)) { echo $row['author']; echo $row['shortstory']; } mysql_close($conn); ?> Thanks a lot.
  5. Yes I know this, but the download didn't include a DB.php... ??? Strange I know. Anyway I think with the code from the two files I provided it should be possible to get it working and also you don't really need to know the library you just need to know php and mysql. The javascript and html and everything is all done and working. I just need to be able to add to the database the divs id and the content of the div when the form is submitted.
  6. From just taking a quick look at your code there isn't a php start tag at the top. ???
  7. First post here so hey guys. I'm using jEditable and the jQuery library on my Website. If you don't know what it is then I'll try explain. It allows you to edit content inline, for example: <div class="edit" id="one">Content</div> If I used that code then I could click on "Content" and then it would change to a text input field then I could change it and hit Enter and it would change. When you hit enter the id of the div and the content of the div is sent to a file called save.php. The documentation/example for jEditable uses SQL Lite / Pear DB or something, but I want to use MYSQL. I'd like it so for every unique id I have there is a new row in a table in the database. Say if I have one with the id of "blah" and the content is "wee" then I change the content to "woo" would it update the row instead of adding a new one? Any and all help is appreciated. Here is the code for save.php and dbInformation.php in case anyone needs it. <?php require_once 'dbConnection.php'; mysql_query("CREATE TABLE config( id INT PRIMARY KEY, token VARCHAR(64), value TEXT )") $status = $dbh->query(' CREATE TABLE config (id INTEGER PRIMARY KEY, token VARCHAR(64), value TEXT) '); $id = $dbh->nextId('config'); $query = sprintf("INSERT INTO config (id, token, value) VALUES (%d, '%s', '%s')", $id, $_POST['id'], stripslashes($_POST['value'])); $status = $dbh->query($query); /* sleep for a while so we can see the indicator in demo */ usleep(2000); $renderer = $_GET['renderer'] ? $_GET['renderer'] : $_POST['renderer']; if ('textile' == $renderer) { require_once './lib/Textile.php'; $t = new Textile(); print $t->TextileThis(stripslashes($_POST['value'])); } else { print $_POST['value']; } ?> And dbConnection.php <?php require_once 'DB.php'; $dsn = array( 'phptype' => 'sqlite', 'database' => '/tmp/editable.db', 'mode' => '0666' ); $dbh =& DB::connect($dsn); $dbh->query(" CREATE TABLE config (id INTEGER primary key, token VARCHAR(255), value TEXT, date DATETIME) "); mysql_query("CREATE TABLE config( id INT PRIMARY KEY, token VARCHAR(255), value TEXT date DATETIME)") ?> I know dbInformation requires a file called DB.php but that wasn't included with the download, hope it isn't a problem. Thanks a LOT.
×
×
  • 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.