| |
|
|
Programming and Scripts: Web Developers Forum
04-21-2005, 08:52 PM
|
#1
|
|
Super Moderator
Join Date: Mar 2005
Location: England
Posts: 182
|
Help! -- php
I'm having a bit of trouble with a php and sql script, the script below is the one that is not working. I'm an ameture at this, so please excuse me if it's a really simple answer.
When I use the below script the responce is:
Quote:
Warning: mysql_query(): Access denied for user: 'rauru@localhost' (Using password: NO) in /home/rauru/public_html/blog/admin/process.php on line 17
Warning: mysql_query(): A link to the server could not be established in /home/rauru/public_html/blog/admin/process.php on line 17
Couldn't create the update
|
Code:
<?php
include("admin/connect.php");
$update_name = $_POST['update_name'];
$blogshort = $_POST['blogshort'];
$bloglong = $_POST['bloglong'];
if ($update_name="" AND $blogshort="" AND $update_name="")
{
header("Location: admin/update.php");
}
else
{
$update = "INSERT INTO
blog ('update_name, date, blog, bloglong)
values('$update_name','".time()."','$blog','$bloglong')";
mysql_query($update) or die("Couldn't create the update");
header("Location: index.php");
}
?>
Is there any reason for this?
|
|
|
04-22-2005, 12:01 AM
|
#2
|
|
TalkWebDev Enthusiast
Join Date: Mar 2005
Posts: 37
|
The error looks like it means that PHP could not connect to your MySQL server.
You either:
a. Did not including the correct connect.php file
b. Have the wrong login information for MySQL in your connect.php
c. Are not connecting to the correct server OR
d. Your user does have sufficient MySQL privileges
__________________
Sticky Icky
Last edited by Purple Haze : 04-22-2005 at 04:57 PM.
|
|
|
04-22-2005, 11:21 PM
|
#3
|
|
Super Moderator
Join Date: Mar 2005
Location: England
Posts: 182
|
All of the info is correct on the connect.php file, I can't see why it would be connecting to the wrong server. I use localhost as the server, and the database is fine.
|
|
|
04-23-2005, 12:35 AM
|
#4
|
|
TalkWebDev Enthusiast
Join Date: Mar 2005
Posts: 37
|
If you are hosting your own server, I would check to make sure your MySQL user has sufficient permissions, otherwise, I can't see why you would be having this error, I'll check it out more later.
__________________
Sticky Icky
|
|
|
04-25-2005, 07:59 PM
|
#5
|
|
Super Moderator
Join Date: Mar 2005
Location: England
Posts: 182
|
Quote:
Warning: mysql_query(): Access denied for user: 'rauru@localhost' (Using password: NO) in /home/rauru/public_html/blog/admin/process.php on line 17
Warning: mysql_query(): A link to the server could not be established in /home/rauru/public_html/blog/admin/process.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /home/rauru/public_html/blog/admin/process.php:17) in /home/rauru/public_html/blog/admin/process.php on line 18
|
PHP Code:
<?php
include("http://blog.raurusreturn.net/admin/connect.php");
$update_name = $_POST['update_name'];
$blogshort = $_POST['blogshort'];
$bloglong = $_POST['bloglong'];
$date = time();
if ($update_name=="" AND $blogshort=="" AND $update_name=="")
{
header("Location: http://blog.raurusreturn.net/admin/update.php");
}
else
{
mysql_query("INSERT INTO
blog ('update_name', 'date', 'blog', 'bloglong')
values($update_name,$date,$blog,$bloglong)");
header("Location: index.php");
}
?>
I changed the code a little, and I got a new error. It seems to be isolated around the value area. But usually errors are before that line. So I can't really seem to find the error.
The mysql_query works, as I use it in other scripts.
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 05:39 PM.
|
 |
 |
|
|