what size are you talking about?Originally posted by CareBear
as the file grows
6kb? 50kb? 500? 1Mb?
Front what size will it have some slowdowns?
what size are you talking about?Originally posted by CareBear
as the file grows
That's not something anyone can answer since it depends a lot on the server.Originally posted by Wojtek
what size are you talking about?
6kb? 50kb? 500? 1Mb?
Front what size will it have some slowdowns?
Im not using this script as a news script. But as a poem archive.Originally posted by spec
Carebear is right. Its much more efficient for you to take the load then your visitors. You are one user, as apposed to thousands of users. And Wojtek My question still stands, why reinvent the wheel. your code allows you to add news, but what about editing, deleting, multi-users? Long term, downloading a script is far wiser, unless there are no scripts that do what you want them to do.
Just take a step and think of it as something that would happen in real life .Originally posted by Wojtek
"Its much more efficient for you to take the load then your visitors. You are one user, as apposed to thousands of users"
I understand what you mean, but i dont know where the problem is? is it in the script that ads the content? or reads the content?
<?include "header.php"?>
<?
$dbh=mysql_connect ("localhost", "wojtek_poems", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("wojtek_poems");
select Category, Title, Poem, Author, Score from wojtek_poems
where Category = 'Love Poems';
?>
<?include "footer.php"?>
<?include "header.php"?>
<?
$dbh=mysql_connect ("localhost", "wojtek_poems", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("wojtek_poems");
if(!isset($poem)) $poem = 0;
$query = "SELECT * FROM wojtek_poems where Category = 'Love Poems' LIMIT " . $poem . ", 1";
$result = mysql_query($query) or die ('I cannot connect to the database because: ' . mysql_error());
$query = "SELECT count(*) as count FROM table";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$numrows = $row['count'];
if($poem > 0)
echo "<a href=\"" . $PHP_SELF . "?poem=" . ($poem - 1) .
"\">Previous</a><BR>\n";
if($numrows > ($poem + 1))
echo "<a href=\"" . $PHP_SELF . "?poem=" . ($poem + 1) .
"\">Next</a><BR>\n";
?>
<?include "footer.php"?></p>
// from first snippet
$query = "select Category, Title, Poem, Author, Score from wojtek_poems where Category = 'Love Poems'";
$result = mysql_query($query);
//from second snippet
//this statement is pretty silly
$query = "SELECT * FROM wojtek_poems where Category = 'Love Poems' LIMIT " . $poem . ", 1";
create table Poems
(Category varchar,
Title varchar,
Author varchar,
Poem varchar,
Score number,
Comments varchar);
Database wojtek_poems running on localhost
Error
SQL-query :
CREATE TABLE Poems(
Category varchar,
Title varchar,
Author varchar,
Poem varchar,
Score number,
Comments varchar
)
MySQL said:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '
Title varchar,
Author varchar,
Poem varchar,
Score number,
Com
CREATE TABLE `poems` (
`id` INT( 4 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
`category` VARCHAR( 50 ) DEFAULT 'None' NOT NULL ,
`title` VARCHAR( 50 ) DEFAULT 'None' NOT NULL ,
`author` VARCHAR( 100 ) DEFAULT 'None' NOT NULL ,
`poem` TEXT NOT NULL ,
`score` INT( 5 ) NOT NULL ,
`comments` VARCHAR( 250 ) NOT NULL ,
UNIQUE (
`id`
)
);
CREATE TABLE `love` (
`id` INT( 4 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
`category` VARCHAR( 50 ) DEFAULT 'None' NOT NULL ,
`title` VARCHAR( 50 ) DEFAULT 'None' NOT NULL ,
`author` VARCHAR( 100 ) DEFAULT 'None' NOT NULL ,
`poem` TEXT NOT NULL ,
`score` INT( 5 ) NOT NULL ,
`comments` VARCHAR( 250 ) NOT NULL ,
UNIQUE (
`id`
)
);
<?php
if($Title) {
$Title=$_GET['Title'];
$dbh=mysql_connect ("localhost", "wojtek_poems", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("wojtek_poems");
insert into love
(Author, AuthorEmail, Title, Cateory, Poem, Comment)
values ($_GET['Author'], $_GET['AuthorEmail'], $_GET['Title'], $_GET['Category'], $_GET['Poem'], $_GET['Comment']);
echo "Poem Added";
}
?>
<?include "../header.php"?>
<font face="verdana" size="1">
<form method="get" action="AddPoem.php">
<p align="center"><b>Add a Poem</b></p>
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<font face="verdana" size="1">Author:
</font>
</td>
<td>
<font face="verdana" size="1">
<input type="text" name="Author" size="50">
</font>
</td>
</tr>
<tr>
<td>
<font face="verdana" size="1">Author Email/Url:
</font>
<p> </td>
<td>
<font face="verdana" size="1">
<input type="text" name="AuthorEmail" size="50">
</font>
<p> </td>
</tr>
<tr>
<td>
<font face="verdana" size="1">
Poem Title:
</font>
</td>
<td>
<font face="verdana" size="1">
<input type="text" name="Title" size="50">
</font>
</td>
</tr>
<tr>
<td>
<font face="verdana" size="1">
Category:
</font>
</td>
<td>
<font face="verdana" size="1">
<select size="1" name="Category">
<option>Birthday</option>
<option>Childrens</option>
<option>Christmas</option>
<option>Easter</option>
<option>Famous</option>
<option>FathersDay</option>
<option>Friendship</option>
<option>Graduation</option>
<option>Humorous</option>
<option>Love</option>
<option>Marriage Poems</option>
<option>MothersDay</option>
<option>NewYears</option>
<option>Passover</option>
<option>Philosophical</option>
<option>Sonnets</option>
<option>ThankYou</option>
<option>ValentinesDay</option>
<option>Other</option>
</select>
</font>
</td>
</tr>
<tr>
<td>
<font face="verdana" size="1">
Poem:
</font>
</td>
<td>
<font face="verdana" size="1">
<textarea name="Poem" cols="50" rows="10"></textarea>
</font>
</td>
</tr>
<tr>
<td><font face="verdana" size="1">Comment:</font></td>
<td>
<font face="verdana" size="1">
<input type="text" name="Comment" size="50">
</font>
</td>
</tr>
</center>
<center>
<tr>
<td colspan="2">
<p align="center">
</td>
</tr>
<tr>
<td colspan="2">
<p align="center">
<font face="verdana" size="1">
<input type="submit" value=" Add Poem ">
</font>
</td>
</tr>
</table>
</center>
</div>
</form>
</font>
<?include "../footer.php"?>
<?php
if(!empty($_GET['action'])) {
if($_GET['$action'] != 'add') die('Please use the form to add');
if(!empty($_GET['Title'])) $title= $_GET['Title'];
if(!empty($_GET['Author'])) $author = $_GET['Author'];
if(!empty($_GET['AuthorEmail'])) $email = $_GET['AuthorEmail'];
if(!empty($_GET['Category'])) $cat = $_GET['Category'];
if(!empty($_GET['Poem'])) $poem = $_GET['Poem'];
if(!empty($_GET['Comment'])) $comments = $_GET['Comment'];
$dbh=mysql_connect ('localhost', 'wojtek_poems', 'PASSWORD') or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ('wojtek_poems');
$query = "insert into love
( title, author, poem, comments)
values ('$title', '$author', '$poem', '$comments')";
$result = mysql_query($query);
echo "Poem Added";
}
?>
<?include "../header.php"?>
....
<form method="get" action="AddPoem.php?action=add">
if(!empty($_GET['Title'])) $title= $_GET['Title'];
else die('Please add a title');
if(!empty($_GET['Author'])) $author = $_GET['Author'];
else die('Please add a author');
if(!empty($_GET['AuthorEmail'])) $email = $_GET['AuthorEmail'];
else die('Please add a Author Email');
if(!empty($_GET['Poem'])) $poem = $_GET['Poem'];
else die('Please add a Poem');
if(!empty($_GET['Comment'])) $comments = $_GET['Comment'];
else die('Please add Comments');
<?php
if(!empty($_GET['Author'])) {
if(!empty($_GET['Author'])) $author = $_GET['Author'];
if(!empty($_GET['AuthorEmail'])) $email = $_GET['AuthorEmail'];
if(!empty($_GET['Title'])) $title= $_GET['Title'];
if(!empty($_GET['Category'])) $cat = $_GET['Category'];
if(!empty($_GET['Poem'])) $poem = $_GET['Poem'];
if(!empty($_GET['Comment'])) $comment = $_GET['Comment'];
$dbh=mysql_connect ('localhost', 'wojtek_poems', 'password') or die ('I cannot connect to the database because: ' .
mysql_error());
mysql_select_db ('wojtek_poems');
$query = "insert into " . $cat . "
(Author, AuthorEmail, Title, Poem, Comment)
values ('$author', '$email', '$title', '$poem', '$comment')";
$result = mysql_query($query);
echo "Poem Added";
}
?>
<?include "header.php"?>
<form method="get" action="test.php">