RE: [PHP-DB] Help please
| From: | richarda at askr dot easysoft dot com | Date: | Tue, 10 Apr 2001 09:16:43 +0000 |
| Subject: | RE: [PHP-DB] Help please | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-8420@lists.php.net to get a copy of this message | ||
$validate = mysql_query("SELECT username, user_password FROM users
WHERE username='".$uname."'",$db);
I'm assuming that the username field is a string type - hence the single
quotes.
_____
~ Richard Allsebrook ~
Applications Developer and Webmaster
Easysoft Limited, Thorp Arch Grange, Thorp Arch, Wetherby, LS23 7BA, UK
http://www.easysoft.com <http://www.easysoft.com> -
http://www.cinema.com <http://www.cinema.com>
"A computer lets you make more mistakes faster than any invention in
human history - with the possible exceptions of handguns and tequila."
_____
-----Original Message-----
From: webmaster [mailto:webmaster@kyid.net]
Sent: Tuesday, April 10, 2001 12:16 AM
To: php-db
Cc: webmaster
Subject: FW: [PHP-DB] Help please
Hi all,
I have a website that I am trying to develop a "add news" page for.
Basically people who have the authority to add news for the site can
type in
their username, password, the title of the article, and the article
itself
and submit it to the site (which then verifies the username and password
and
if successfull adds it to the DB so the news will appear the next time
somone browses to the website.
This file is an included file into the main page...the $db variable is
valid, and works with all the other pages so far... I am really stumped
and
getting frustrated.
I apologise in advance if I am including too much code in my
example....the
place with the error is a couple lines from the bottom of the code
sample.
My problem is that I am getting an error when i try to submit the form,
code
sample is below.
The error is:
Warning: Supplied argument is not a valid MySQL-Link resource in
/usr/www/kyid/public_html/addnews.php on line 42
<?php
$size=20;$cols=46;
echo "<div align=\"center\">";
if(!$submit){
echo "<form method=\"post\" action=\"addnews.php\">\n";
echo
"<table><tr><td> </td></td></table>\n";
echo "<table width=\"450\" border=\"0\"
cellspacing=\"1\"
cellpadding=\"2\" align=\"center\">\n";
echo "<tr valign=\"top\">\n";
echo "<td bgcolor=\"#6A7292\" class=\"text\">*
UserName<br>\n";
echo "<input type=\"text\" name=\"uname\"
class=\"input\"
maxlength=\"20\" size=\"".$size."\" value=\"\">\n";
echo "<br>\n";
echo "</td>\n";
echo "<td bgcolor=\"#6A7292\" class=\"text\">*
Password<br>\n";
echo "<input type=\"password\" name=\"password\"
class=\"input\"
size=\"".$size."\" value=\"\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td bgcolor=\"#565d77\" class=\"text\">*
Headline<br>\n";
echo "<input type=\"text\" name=\"headline\"
class=\"input\"
maxlength=\"40\" size=\"".$size."\" value=\"\">\n";
echo "<br>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td colspan=\"2\" bgcolor=\"#565d77\"
class=\"text\">*
Story<br>\n";
echo "<textarea name=\"newstext\"
cols=\"".$cols."\"
wrap=\"VIRTUAL\" rows=\"10\"
class=\"input\"></textarea>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td bgcolor=\"#7B819A\" align=\"center\"
colspan=\"2\">\n";
echo "<input type=\"submit\" name=\"submit\"
value=\"Add
Article\" class=\"submit\"><input type=\"reset\"
name=\"reset\"
value=\"Clear\" class=\"submit\">\n\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table></form>\n";
}else{
/* More stuff would go in here, but this isn't working. */
/******** THE LINE BELOW THIS IS THE ERROR LINE ********/
$validate = mysql_query("SELECT username, user_password FROM
users
WHERE username=".$uname,$db);
}
echo "</div>";
Thanks in advance for any help, or please let me know if this should be
on
php-general instead...
Again, thanks
Keith Young.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
Attachment: [application/rtf]
Attachment: [application/rtf]