Re: Elementary Problem
| From: | dwalker | Date: | Tue, 22 Oct 2002 05:41:38 +0000 |
| Subject: | Re: Elementary Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120858@lists.php.net to get a copy of this message | ||
What do the line numbers look like? In other words which line is 27 and 31?
Some of your stuff word wrapped and it is difficult to tell. If I counted
correctly, it looks as thought it might be complaining about:
mysql_query("INSERT INTO articles(articleId, title, content)
VALUES ('$articleId', '$title', '$content')");
I'm guessing, but try:
mysql_query("INSERT INTO articles(articleId, title, content)
VALUES ($articleId, $title, $content)");
Or Try to echo the each variable some how.
mysql_query("INSERT INTO articles(articleId, title, content)
VALUES (<?php echo $articleId ?>, <?php echo $title ?>, <?php echo
$content?>)");
-----Original Message-----
From: php@erars.demon.co.uk <php@erars.demon.co.uk>
To: php-general@lists.php.net <php-general@lists.php.net>
Date: Monday, October 21, 2002 4:38 PM
Subject: [PHP] Elementary Problem
>I have recently moved one php app from one server to another, it is working
fine on one system but has thrown up several errors on the new one. I am
convinced that it is a simple fault but I just can't see it.
>
>These are the errors I get:
>
>---------------------------------------------------------------------------
-----
>
>Notice: Undefined variable: articleId in C:\phpweb\submitnews.php on line
27
>
>Notice: Undefined variable: title in C:\phpweb\submitnews.php on line 27
>
>Notice: Undefined variable: content in C:\phpweb\submitnews.php on line 27
>Article Uploaded:
>Notice: Undefined variable: title in C:\phpweb\submitnews.php on line 31
>
>This is the submitnews.php script:
>
><html>
><body>
><title> Add Item to Testhouse Databases</title>
><style>
>
> body { color:#000000; font-family: Verdana; font-size:9pt }
> th { color:#FFFFFF; font-family: Verdana; font-size:9pt }
> td { color:#000000; font-family: Verdana; font-size:8pt }
> a { color:#000000; font-family: Verdana; font-size:8pt;
font-weight: bold; }
>
></style>
><img src="testhouse.gif">
>
></head>
><body bgcolor="#C2D7EA">
>
><h2>Results:-</h2>
> <hr noshade size="1" color="#20158F">
><?php
>
>mysql_connect ("localhost");
>
>
>mysql_select_db ("content");
>
>mysql_query("INSERT INTO articles(articleId, title, content)
> VALUES ('$articleId', '$title', '$content')");
>
>
>print("Article Uploaded:");
>print($title);
>print("<p>");
>
>
>?>
></body>
></html>
>
>What is strange is that an articleID is actually added but nothing else
even though it says that articleId is undefined.
>
>This the form script where the data is added from:
>
><html>
><head>
><title> Upload a News Article </title>
></head>
><body bgcolor="#FFFFFF">
><a href="http://www.testhouse.org.uk">
><img border="0" src="testhouse.gif">
></a>
>
><form action="submitnews.php" name="post">
><input type="hidden" name="articleId" value="NOT NULL">
>
><table border="0" cellpadding="0" cellspacing="0"
>bordercolor="#111111"
width="100%">
>
><tr>
><td width="100%" bgcolor="#999999" height="22"
>colspan="2">
><p style="margin-left: 10"><b><font face="Verdana"
>size="2"
color="#FFFFFF">
>Upload a News Article</font></b></td>
>
></tr>
>
><tr>
><td width="100%" bgcolor="#FFE300" height="22"
>colspan="2">
><br>
><p style="margin-left: 10"><b><font face="Verdana"
>size="2"
color="#FFFFFF">
></font></b></td>
>
></tr>
>
>
><tr>
><td width="15%" bgcolor="#FFE300">
><p style="margin-left: 10"><font face="Verdana"
>size="2">
>Article Title:</font></td>
><td width="85%" bgcolor="#FFE300">
><input type="text" name="title" size="20"
>maxlength="20"></td>
></tr>
>
><tr>
><td width="100%" bgcolor="#FFE300" height="22"
>colspan="2">
><br>
><p style="margin-left: 10"><b><font face="Verdana"
>size="2"
color="#FFFFFF">
></font></b></td>
>
></tr>
>
>
><tr>
><td width="15%" bgcolor="#FFE300">
><p style="margin-left: 10"><font face="Verdana"
>size="2">
>Article Body:</font></td>
><td width="85%" bgcolor="#FFE300">
><textarea name ="content" rows=16 cols=60 input type="text"
name="content"></textarea></td>
></tr>
>
>
><tr>
><td width="15%" bgcolor="#FFE300">
><p style="margin-left: 10"><font face="Verdana"
>size="2">
></font></td>
><td width="85%" bgcolor="#FFE300">
><br>
><input type="submit" name="submit"
>value="Publish"></td>
></tr>
>
><tr>
><td width="100%" bgcolor="#FFE300" height="22"
>colspan="2">
><br>
><p style="margin-left: 10"><b><font face="Verdana"
>size="2"
color="#FFFFFF">
></font></b></td>
></tr>
>
>
><tr>
><td width="100%" bgcolor="#999999" height="22"
>colspan="2">
><br>
><p style="margin-left: 10"><b><font face="Verdana"
>size="2"
color="#FFFFFF">
></font></b></td>
>
></tr>
>
> </table>
> </form>
>
>
></body>
></html>
>
>Thanks in advance for any help or direction.
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>