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?
Did you know?Explore Trending and Topic pages for more stories like this.

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 Like 8 Dislike
Previous forums Next forums
Other forums

Procedural to OOP
John Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pr

a dificult string search
Hi I don't know a way around this. I want the user to input a password, but to make it a bit complca

IP Based Cron Jobs
I run cronjobs on my website. After one of my visitors got curious and tinkered around he realized h

Character Sets/Collations Stuff
Can someone please give me a check list of things I must do to setup all the charset stuff for my ph

DELETE FROM not working deletes wrong row
Hello

I have the following code which i found but it doesnt work properly.. it comes up with

I apologise! It's a newbie to PHP feedback form problem!
Hi,

I am a total newbie to PHP. I am also a unemployed and need to get a job. So after 100% r

Upload simple problem
Really confused!! I run once and it worked, but when i tried today...it didn't work

Which par

path to include folder
Hi everyone,

When I'm testing locally, I have to add the name of the site folder as part of t

how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s

FAGL_FC_TRANSLATION FAS52 New GL ECC 6.0
Hello,

The new program for Translating GL Balances (FAS 52) gives the option to use diffe

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash