weyhey15 Posted August 7, 2008 Share Posted August 7, 2008 Ok when i use this script below it just doesnt work i get that error of using password : NO even though i have and then when i execute the sql for the news to be stored nothing appears after can anyone help ? news.php <?php = "SELECT *," . "DATE_FORMAT(postdate, '%Y-%m-%d') as date " . "FROM news ORDER BY id DESC LIMIT "; // 1. = mysql_query(); include "var.php"; while(=mysql_fetch_array()) // 2. { echo "<br><table width='100%'><tr bgcolor=''><td> <img src=''><b></b> posted on </td></tr> <tr bgcolor=''><td></td></tr> </table><br>"; } ?> add.php <?php include "var.php"; // 1. if ($action==add) // 2. { $title=$_POST['title']; $content=$_POST['content']; // 3. mysql_query("insert into news (title,content) VALUES ('$title','$content')"); echo "<a href='index.php'>Home</a>"; // 4. } else // 4. { print "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td><form name=\"form1\" method=\"post\" action=\"add.php?action=add\"> <div align=\"center\"> <p>Title: <input type=\"text\" name=\"textfield\"> </p> <p>News content : <textarea name=\"title\" cols=\"50\" rows=\"10\" id=\"title\"></textarea> </p> <p> <input type=\"submit\" name=\"Submit\" value=\"Add\"> </p> </div> </form></td> </tr> </table>\n"; } ?> var.php <?php //////////////////////////////////////////////////////////////////////////////////////// ="xxxx"; // number of news that script shows ="xxxx"; // db username ="xxxx"; // password ="xxxx"; // database name ="xxxx"; // path to the bullet image ="xxxx"; // bg color for title cell in RGB...(black = #000000) ="xxx"; // bg color for news cell in RGB...(black = #000000) //////////////////////////////////////////////////////////////////////////////////////// = mysql_connect("localhost", "", ""); mysql_select_db("", ); // ?> oh and i have the sql but when you execute it, nothing appears this is the sql CREATE TABLE news ( id int(10) unsigned NOT NULL auto_increment, postdate timestamp(14) NOT NULL, title varchar(50) NOT NULL default '', content text NOT NULL, PRIMARY KEY (id), KEY postdate (postdate), FULLTEXT KEY content (content) ) so can any tell when whats going wrong please Link to comment https://forums.phpfreaks.com/topic/118603-news-script/ Share on other sites More sharing options...
MasterACE14 Posted August 7, 2008 Share Posted August 7, 2008 you have = all over the place, with no variable name infront of it. Thats your problem. Link to comment https://forums.phpfreaks.com/topic/118603-news-script/#findComment-610657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.