Jump to content

Recommended Posts

Hi all, Ive got a news script for my website witch can show updates etc

 

main.php

<?php
session_start();
include "config.php";  include "includes/functions.php";
?>

<html>
<head>
<link rel=stylesheet href=includes/in.css type=text/css>
<title>Updates</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body>

<table class="Main" width="50%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000">

<tr><td background="includes/grad.gif" height="39" colspan="2" class="TableHeading"><b><u>Game updates</u></b></td>
</tr>

<?
$select_updates=mysql_query("SELECT * FROM updates ORDER BY id DESC");
while($the=mysql_fetch_object($select_updates)){
?>

<tr><td background="includes/grad.jpg" class='TableSub' height=20 width=70%><center><b>By: <? echo "<A href='profile.php?viewuser=$the->username'>$the->username</a>"; ?> On: <? echo "$the->time"; ?></b></center></td></tr>
<tr><td class='TableArea' colspan=2 width=30%><? echo "$the->update<p>"; ?></td></tr>

<?
}
?>

</table>

<br>

<?php if ($fetch->level == "owner"){ 
if (strip_tags($_POST['submit']) && (strip_tags($_POST['update'] != ""))){
$update=strip_tags($_POST['update']);
$date = gmdate('Y-m-d h:i:s');
mysql_query("INSERT INTO `updates` ( `id` , `username` , `time` , `update` ) 
VALUES (
'', '$username', '$date', '$update'
)");
echo "Update has been added";
}
}
?>

<form name="form1" method="post" action="">
  <table width="450x" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class="Main">
    <tr><td class="TableHeading">Add an update</td></tr>
    <tr><td class="TableArea" align="center">Add an update:
      <textarea name="update" cols="80" rows="5" id="update"></textarea>
      <input name="submit" type="submit" id="submit" value="Add update"><br>
    </td></tr>
  </table>
</form>
<p> </p>
<table align="center" width="482" height="47" border="2" bgcolor="#000000">
  <tr><td width="470">
  <center>
    <p><b><img src="Images/question mark.jpg"></b><br>
      <strong><font color="#CCCCCC">Info about website be posted here soon </font></strong>    </p>
    </center>

  </table>
</tr></td>
</body>
</html>

 

But were it is ment to insert into the database its not.. Any one know why?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/172099-solved-insert-into/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.