Re: [PHP] Help with a script

This is a discussion on Re: [PHP] Help with a script within the PHP General forums, part of the PHP Programming Forums category; Heres the source of the page where I initially enter the data - ------------------------------------------------------------------------- --------------------------------------------------------- <body> <hr noshade color="...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-23-2003
Stevie D Peele
 
Posts: n/a
Default Re: [PHP] Help with a script

Heres the source of the page where I initially enter the data -

-------------------------------------------------------------------------
---------------------------------------------------------
<body>
<hr noshade color="black" size="2">
<font face="Verdana, sans-serif" size="1">
<h2><B>MyPHP Site News v1.0</b></h2>
<Table border="0" width="100%">
<tr>
<td width="20%" valign="Top">
<form action="sitenews.php" method="POST">
Your Alias:</td>
<td width="80%" valign="Top">
<input type="text" name="newsperson" style="border: 1px solid black;
font-family: Verdana, sans-serif;"
onFocus="this.className='focus'" onBlur="this.className='blur'"></td>
</tr>
<tr>
<td width="20%">Date:</td>
<td width="80%"><input type="text" name="date" style="border: 1px solid
black; font-family: Verdana, sans-serif;"
onFocus="this.className='focus'" onBlur="this.className='blur'"> <font
size="2">Ex) 2003-08-19</font></td>
</tr>
<Tr>
</tr>
<td width="20%" valign="Top">Your News:<br><font size="2">Enter as much
text as you would like here</font></td>
<Td width="80%" valign="top"><textarea rows="5" cols="45" name="thenews"
style="border: 1px solid black; font-family: Verdana, sans-serif;"
onFocus="this.className='focus'"
onBlur="this.className='blur'"></textarea></td>
</tr>
<tr>
<td width="20%"></td>
<td width="80%">
<input type="submit" value="Submit Entry" class="mybutton"><input
type="reset" value="Clear Form" class="mybutton"></td>
</tr>
</table>
</form>
<hr noshade color="black" size="2">
<center><font face="Verdana, sans-serif" size="1">PHP Site News developed
by Stevie Peele</font></center>
</body>
-------------------------------------------------------------------------
---------------------------------------------------------
On Sat, 23 Aug 2003 08:18:19 -0700 "Jim Lucas" <phplist@zonedzero.net>
writes:
> what is the source for the page that you initially enter the data on
> the web
> form look like?
>
> Jim Lucas
> ----- Original Message -----
> From: "Stevie D Peele" <sdp2006@juno.com>
> To: <php-general@lists.php.net>
> Sent: Saturday, August 23, 2003 6:25 AM
> Subject: [php] Help with a script
>
>
> > I've been working on a script for quite some time now, particulary

> a site
> > news script. Heres how it works
> >
> > 1. Information is passed from a form to the database
> > 2. Table is selected to a page to be viewed by the general

> public.
> >
> > The problem is, when I use the form, there are no errors in the

> script,
> > but nothing is entered into the database.
> >
> > Here are my scripts
> > ------------------------------------The
> > Query------------------------------------
> > CREATE TABLE SiteNews
> > (
> > Alias varchar(50) NOT NULL default '0',
> > News BLOB NOT NULL,
> > NewsDate Date NOT NULL
> > ) TYPE=MyISAM
> >

>

-------------------------------------------------------------------------
> > ---------
> >
> > ------------------------------------form
> > action------------------------------------
> > <?php
> > include ('config.php');
> > $link = @mysql_pconnect($location, $username, $password)
> > or die("Could not connect to the databaseserver. Please go

> back and
> > try again or try again later.");
> > @mysql_select_db($database, $link)
> > or die ("Could not select database. Please go back and try

> again or
> > try again later.");
> > $sql_insert = "INSERT INTO SiteNews ('Alias','News','NewsDate')
> > VALUES ('". addslashes($_POST['newsperson']) . "','" .

> $_POST['date'] .
> > "','" . addslashes($_POST['thenews']) . "')";
> >
> > $result = mysql_query($sql_insert, $link);
> > echo (mysql_affected_rows($link) . " News entry inserted");
> > ?>
> >

>

-------------------------------------------------------------------------
> > -------------
> >
> > ------------------------------------Viewing the news
> > script---------------------------
> > <?php
> > include ('config.php');
> > $link = @mysql_pconnect($location, $username, $password)
> > or die("Could not connect to the databaseserver. Please go

> back and
> > try again or try again later.");
> > @mysql_select_db($database,$link)
> > or die ("Could not select database. Please go back and try

> again or
> > try again later.");
> > $sql = "SELECT Alias, NewsDate, News FROM SiteNews ORDER BY

> NewsDate
> > DESC";
> > $news = mysql_query($sql,$link) or

> die(mysql_error().'<p>'.$sql.'</p>');
> >
> > if ($news){
> > if (mysql_num_rows($news)== 0){
> > echo ("No newsitems found.");
> > }
> > else{
> > while ($row = mysql_fetch_assoc($news)){
> > echo("<p>");
> > echo($row['Alias']. "<br />");
> > echo($row['NewsDate']."<br />");
> > echo($row['News']);
> > echo("</p>");
> > echo("<hr />");
> > }
> > }
> > }
> > else{
> > echo("Queryproblem");
> > }
> >
> > ?>
> >

>

-------------------------------------------------------------------------
> > -------------
> >
> > Can anyone see what is wrong??
> >
> > Thanks

>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


__________________________________________________ ______________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:08 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0