Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql error

Status
Not open for further replies.

manicleek

Technical User
Jun 16, 2004
143
GB
I have an edit script

Code:
$ID = $_POST["id"];
$title = $_POST["title"];
$restaurant = $_POST["name"];
$desc = $_POST["desc"];
$author = $_POST["author"];
$pic1 = $_POST["pic1"];
$pic2 = $_POST["pic2"];

$editSQL = "UPDATE review SET ";
$editSQL .= "ReviewTitle = '" . addslashes($title) . "', ";
$editSQL .= "ReviewDesc = '" . addslashes($desc) . "', ";
$editSQL .= "RestaurantName = '" . addslashes($restaurant) . "', ";
$editSQL .= "CreatedBy = '" . addslashes($author) . "' ";
$editSQL .= "image1 = '" . $pic1 . "' ";
$editSQL .= "image2 = '" . $pic2 . "' ";

$editSQL .= "WHERE review = '" . $ID . "'";

$results = mysql_query($editSQL);

which is producing an error

Code:
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in C:\sites\newqfol\edit\alanreviews\edited.php on line 32

line 32 being the mysql_query line

any ideas what the problem is?
 
yeah, the full code is:

Code:
session_start();

include($_SERVER['DOCUMENT_ROOT']."/includes/connection.php");

if (!isset($_SESSION['valid'])) 
{ 
   //go to login
   header ("Location: /edit/unknown.php");
   exit();
}

$ID = $_POST["id"];
$title = $_POST["title"];
$restaurant = $_POST["name"];
$desc = $_POST["desc"];
$author = $_POST["author"];
$pic1 = $_POST["pic1"];
$pic2 = $_POST["pic2"];

$editSQL = "UPDATE review SET ";
$editSQL .= "ReviewTitle = '" . addslashes($title) . "', ";
$editSQL .= "ReviewDesc = '" . addslashes($desc) . "', ";
$editSQL .= "RestaurantName = '" . addslashes($restaurant) . "', ";
$editSQL .= "CreatedBy = '" . addslashes($author) . "' ";
$editSQL .= "image1 = '" . $pic1 . "' ";
$editSQL .= "image2 = '" . $pic2 . "' ";

$editSQL .= "WHERE review = '" . $ID . "'";

$results = mysql_query($editSQL, $connection);
mysql_error($results);

where connection.php has all my connection properties, I know nothing is wrong with that cus the rest of the site is working fine, as are other edit pages
 
did you echo the $editSQL var? may be some , char is out of the string ("..","")

chees.
 
sorry,
but "supplied argument is not a valid MySQL-Link resource"
means that db_connection is not a valid one.

Try a print_r($connection); before of query.

PM

___
____
 
i insist, did you echo the $editSQL var? may be some , char is out of the string ("..","")
 
so? what do you get? the only problem I can see is the sql statment or what predamacel posted.
 
i think that there is a missing comma at the end of the author and the pic1 line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top