Hi ive tried to modify this script to add a new field named Title into the table via the install.php
I think here aint a problem in the above modification...
But then I modified then I started modifing the Addqoute.php file
by adding the lines
and also
im not sure if this modifications is done correctly.
then in the deletequote.php file
i added the lines
on the index.php
I added the line
I'm not sure where I did what wrong can you help me solve my problem please?
Code:
<?php include "admin/connect.php"; $createquotes="CREATE TABLE rquote_quotes ( ID bigint(21) NOT NULL auto_increment, Title mediumtext NOT NULL, quote mediumtext NOT NULL, PRIMARY KEY (ID) )"; mysql_query($createquotes) or die("Could not create quotes"); $createadmins="CREATE TABLE rquote_login ( ID int(10) NOT NULL auto_increment, username varchar(255) NOT NULL default '', password varchar(255) NOT NULL default '', PRIMARY KEY (ID) )"; mysql_query($createadmins) or die("Could not create admins"); print "Installed"; ?>
But then I modified then I started modifing the Addqoute.php file
Code:
<? include "connect.php"; session_start(); if (isset($_SESSION['username'])) { print "<A href='addquote.php'>Add a quote</a> | <A href='deletequote.php'>Delete a quote</a>|<A href='search.php'>Search</a><br><br>"; if(isset($add)) { $addquote="Insert into rquote_quotes (quote) values ('$Title','$quote')"; $r=mysql_query($addquote) or die("Could not insert quote"); if($r) { print "Quote added successfully"; } } else { print "<form action='addquote.php' method='post'>"; print "Type quote here<br>"; print "<textarea name='Title' rows='3' cols='20'></textarea><br>"; print "<textarea name='quote' rows='3' cols='20'></textarea><br>"; print "<input type='submit' name='add' value='add quote'></form>"; } } else { print "Not logged in as Administrator, please <A href='login.php'>Login</a>"; } ?>
Code:
$addquote="Insert into rquote_quotes (quote) values ('$Title','$quote')";
Code:
print "<textarea name='Title' rows='3' cols='20'></textarea><br>";
then in the deletequote.php file
Code:
<? include "connect.php"; session_start(); if (isset($_SESSION['username'])) { print "<A href='addquote.php'>Add a quote</a> | <A href='deletequote.php'>Delete a quote</a>|<A href='search.php'>Search</a><br><br>"; if(isset($delete)) { $ID=$_GET[ID]; $deletequote="Delete from rquote_quotes where ID='$ID'"; $r=mysql_query($deletequote) or die("Could not delete quote"); if($r) { print "Quote delete successfully"; } } else { $quotedelete="SELECT * from rquote_quotes"; $quotedelete2=mysql_query($quotedelete) or die("Could not select"); while($r3=mysql_fetch_array($quotedelete2)) { print "$r3[Title]<br>"; print "$r3[quote]<br>"; print "<form action='deletequote.php?ID=$r3[ID]' method='post'>"; print "<input type='hidden' name='ID' value='$r3[ID]'>"; print "<input type='submit' name='delete' value='delete quote'><br>"; print "</form>"; } } } else { print "Not logged in as Administrator, please <A href='login.php'>Login</a>"; } ?>
Code:
print "$r3[Title]<br>";
Code:
<? include "admin/connect.php"; $randomize="SELECT*FROM rquote_quotes"; $randomize2=mysql_query($randomize); $numrow=mysql_num_rows($randomize2); $j=RAND()%$numrow+1; $r="SELECT * FROM rquote_quotes where ID='$j' LIMIT 1"; $r2=mysql_query($r); while($r3=mysql_fetch_array($r2)) { print "$r3[Title]<br>"; print "$r3[quote]"; } ?>
Code:
print "$r3[Title]<br>";
Comment