Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-23-2006, 09:38 PM Blog not workng
mad_willsy's Avatar
Super Spam Talker

Latest Blog Post:
R&R Catering Hire Testimonial
Posts: 805
Name: Will Craig
Location: Cheltenham, Gloucestershire, UK
Trades: 0
I have scripted a simple blog. I can add articles from phpMyAdmin but I cannot get it towork via a admin panel.

Can somebody please check this code and tell me why it doesn't work.

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>BTB Blog</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
$secs 
date("s");
$fdt $year "-" $month "-" $date " " $hour ":" $mins ":" $secs;
if(
$go == 1)
{
$qstr "INSERT INTO `btb_blog` (`title`, `auth`, `content`, `posted`, `date`, `month`, `year`, `hour`, `mins`) VALUES ($title$auth$content$fdt$date$month$year$hour$mins);";
include(
"config.php");
mysql_query($qstr);
}
?>
<body>
<form name="form1" method="post" action="test.php?go=1">
  <table width="100%"  border="0">
    <tr>
      <td width="38%" valign="top"><p>Author</p>      </td>
      <td width="62%"><input name="auth" type="text" id="auth"></td>
    </tr>
    <tr>
      <td valign="top">Title</td>
      <td><input name="title" type="text" id="title"></td>
    </tr>
    <tr>
      <td valign="top">        Content</td>
      <td><textarea name="content" id="content"></textarea></td>
    </tr>
    <tr>
      <td valign="top">Date (DD) </td>
      <td><input name="date" type="text" id="date" value="<?php echo date("d"); ?>"></td>
    </tr>
    <tr>
      <td valign="top">Month (MM) </td>
      <td><input name="month" type="text" id="month" value="<?php echo date("m"); ?>"></td>
    </tr>
    <tr>
      <td valign="top">Year (YYYY) </td>
      <td><input name="year" type="text" id="year" value="<?php echo date("Y"); ?>"></td>
    </tr>
    <tr>
      <td valign="top">Hour (HH) </td>
      <td><input name="hour" type="text" id="hour" value="<?php echo date("H"); ?>"></td>
    </tr>
    <tr>
      <td rowspan="2" valign="top">Minutes (MM) </td>
      <td><input name="mins" type="text" id="mins" value="<?php echo date("i"); ?>">      </td>
    </tr>
    <tr>
      <td><input type="submit" name="Submit" value="ADD"></td>
    </tr>
  </table>
</form>
</body>
</html>
Thanks.
__________________
Wont :P

Please login or register to view this content. Registration is FREE
mad_willsy is offline
Reply With Quote
View Public Profile Visit mad_willsy's homepage!
 
 
Register now for full access!
Old 07-25-2006, 12:36 PM Re: Blog not workng
Super Talker

Posts: 111
Name: Jonathan
Location: Arizona, USA
Trades: 0
To start, with this:
Code:
if($go == 1) 
{ 
$qstr = "INSERT INTO `btb_blog` (`title`, `auth`, `content`, `posted`, `date`, `month`, `year`, `hour`, `mins`) VALUES ($title, $auth, $content, $fdt, $date, $month, $year, $hour, $mins);"; 
include("config.php"); 
mysql_query($qstr); 
} 
?> 
<body> 
<form name="form1" method="post" action="test.php?go=1">
Your "if($go ==1)" will need to be changed to "if ($_GET['go'] ==1)" if you leave your action="test.php?go=1".

Or, if you do it this way: <input type="hidden" name="go" value="1"> and have your action="test.php" then you'll write "if($_POST['go']==1)".

Or, you could leave it alone and write "if($_REQUEST['go']==1)".

Personally, I'd go with the $_POST option because I don't like putting my variables in the url. But if it's not something you need to worry about others seeing in the url it's all about preference.
__________________

Please login or register to view this content. Registration is FREE
- Computer Repair over the internet!
pcoptimized is offline
Reply With Quote
View Public Profile Visit pcoptimized's homepage!
 
Old 07-25-2006, 09:18 PM Re: Blog not workng
mad_willsy's Avatar
Super Spam Talker

Latest Blog Post:
R&R Catering Hire Testimonial
Posts: 805
Name: Will Craig
Location: Cheltenham, Gloucestershire, UK
Trades: 0
Thanks. Blog developed now. All up and running, but cannot work out how to do archives.

Few things that may help:
Link here
Table (bl_blog) Structure: (attached version is lined up if you open in wordpad)
Field Type Collation Null Default Extra
entryid bigint(20) No auto_increment
author varchar(255) latin1_swedish_ci No
thetime varchar(255) latin1_swedish_ci No
realtime bigint(20) No 0
shortblurb mediumtext latin1_swedish_ci No
maincontent mediumtext latin1_swedish_ci No
month int(11) No 0
year bigint(20) No 0
blogtitle varchar(255) latin1_swedish_ci No


Anything else needed, let me know.
Attached Files
File Type: txt table structure.txt (465 Bytes, 4 views)
__________________
Wont :P

Please login or register to view this content. Registration is FREE

Last edited by mad_willsy; 07-25-2006 at 09:29 PM.. Reason: table structure not lining up :(
mad_willsy is offline
Reply With Quote
View Public Profile Visit mad_willsy's homepage!
 
Reply     « Reply to Blog not workng
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35469 seconds with 13 queries