Jump to content

caroline

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

caroline's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks! do you mean put a comma here: $query.=" [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--],[!--colorc--][/span][!--/colorc--]DATE_FORMAT(entrydate, '%M %d, %Y') AS date"; or here: $query.=" DATE_FORMAT(entrydate, '%M[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--],[!--colorc--][/span][!--/colorc--] %d, %Y') AS date"; sorry if that sounds stupid :)
  2. hi! im using mysql and php to create a blog type system. im using 2php pages and one html page - , addentry.php, weblog.php, and weblog.html ive been following a tutorial online on how to do it buit ive run into problems when trying to add my own code. ill give everyone a look a the code and maybe you could help me out cos im stumped! :) addentry.php: <?php if ($HTTP_POST_VARS['submit']) { mysql_connect("localhost","root",""); mysql_select_db("test1"); $entrytitle=$HTTP_POST_VARS['entrytitle']; $authorName=$HTTP_POST_VARS['authorName']; $entrytext=$HTTP_POST_VARS['entrytext']; $query ="INSERT INTO weblog (entrytitle, authorName, entrytext)"; $query.=" VALUES ('$entrytitle','$authorName','$entrytext')"; $result=mysql_query($query); if ($result) echo "<b>Successfully Posted!</b>"; else echo "<b>ERROR: unable to post.</b>"; } ?> <?php mysql_connect("localhost","root",""); mysql_select_db("test1"); $query ="SELECT entrytitle, authorName, entrytext"; $query.=" DATE_FORMAT(entrydate, '%M %d, %Y') AS date"; $query.=" FROM weblog ORDER BY entrydate DESC LIMIT 10"; $result=mysql_query($query); while (list($entrytitle,$authorName,$entrytext,$entrydate) = mysql_fetch_row($result)) { echo "<dt><b>$entrytitle $authorName ($entrydate)</b></dt>"; echo "<p align='justify'>$entrytext</p>"; } ?> ive a html form setup to add in the data - the weblog.html page. Ive got the adding into the database part functioning, the data is getting added. But the problem is i cant get the data to display from the db in the weblog.php page. all ive modified to the tutorial has been the "authorName". it works fine without this in it. heres the database im using: CREATE TABLE weblog ( entrydate timestamp(14) NOT NULL, entrytitle varchar(100) default NULL, authorName varchar(20) NOT NULL default '', entrytext text, contactID smallint(6) default NULL, email varchar(30) NOT NULL default '', picfile tinytext NOT NULL, PRIMARY KEY (entrydate) ) TYPE=MyISAM; im yet to use some the fields ive setup in the db - just trying to get a few working first!. i keep recieving this same error: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\phpdev\www\public\backup\weblog.php on line 50 i hope someone can help. thanks!! Caroline xxx
×
×
  • 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.