Getting Resource id #11 while trying to connect..
Posted on
16th Feb 2014 07:03 pm by
admin
So i tried using "DEFINE" for the first time and im using the variables i defined to connect but it reports back this error:
QuoteWarning: mysql_query(): 11 is not a valid MySQL-Link resource in /home/content/p/p/f/ppffffpp/html/avalancheatblue.com/nc-cms/system/modules/storage/mysql.php on line 25
Can anyone look at the function and find out why this is?
Code: (php) [Select]<?php
function nc_save_content ($name, $data)
{
$nc_db_link = mysql_connect(NC_DB_HOST, NC_DB_USER, NC_DB_PASSWORD);
$nc_db_link = nc_db_link($nc_db_link, NC_DB_DATABASE);
$x=3;
while($x != 0){
nc_check_content($name.$x, "Edit Me History" . $x);//line 9-14 making sure the history exists (if not creates it)[function is internal]
$x--;
}
//Now start backwards and work from 2-0 moving files for history
$x=2;
$z=1;
while($x != 0){
$temp2 = $name.$x;
$get = "SELECT content FROM " .NC_DB_PREFIX."content WHERE name ='".$temp2."'";
$res = mysql_query($get,$nc_db_link) or die (mysql_error());
$row = mysql_fetch_assoc($res);
$temp = $x + 1;
$insert = "UPDATE ".NC_DB_PREFIX."content SET content='".$row['content']."' WHERE name='".$name.$temp."'";
$res2 = mysql_query($insert,$nc_db_link) or die (mysql_error());
$x--;
}
//one last thing move the current entry to 1 before we overwrite it!!!
$sql = mysql_query("SELECT content FROM " .NC_DB_PREFIX."content WHERE name ='".$name."'",$nc_db_link) or die (mysql_error());
$row = mysql_fetch_assoc($sql);
$insert = mysql_query ("UPDATE ".NC_DB_PREFIX."content SET content='".$row['content']."' WHERE name='".$name."1"."'",$nc_db_link) or die (mysql_error());
nc_check_content ($name, "Edit Me!"); // Make sure database entry exists
$nc_db_result = mysql_query("UPDATE ".NC_DB_PREFIX."content SET content='".nc_db_escape($data)."' WHERE name='".$name."'", $nc_db_link);
if(!$nc_db_result) // Check for query errors
{
nc_report_error("MySQL reported: ".mysql_error());
exit();
}
mysql_close($nc_db_link); // Close connection
}
?>
No comments posted yet
Your Answer:
Login to answer
251
8
Other forums
A Few Questions
Hi, I want to ask a few questions that I can't seem to find..
1) I'm creating a "shortcu
PHP switch function help
Hi, I am trying to create a search function for a directory website. On the search function on html
breaking a text file into paragraphs based on strings
I have a text file of email addresses that is all squished together. It looks like this:
abc
printing links
Hi every1
i am connecting to a table in sql and the looping through with a while ($ var = my
JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w
Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<
AutoChoosing a CSS file based on URL
Hey everyone,
I have a site that has multiple URLs and CSS files.
Based on the URL tha
problem when runing a funciton
I am trying to connect to database using a funciton in a functions.php
<?php
funct
Problem with shopcart code
Hello, I am having a bit of trouble being able to add a product to my shopcart. My mysql database i
Php If in MySql query (hiding labels if a field is empty)
Okay, I've been trying to do this for a while, and I'm finally going to ask for help so I can get th