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
RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai
foreach help.
Hello all,
First time I'm attempting to use a foreach statement and was just wondering if my
please, need help coding this voting for your favorite car polling system.
hi, my code needs a lot of work, but i want to be able to let users vote on their favorite car, upda
php require help needed
Ok i tried to use the search funtion but the word require is everywhere.
i'm really new to cr
Help with search.php
Hello All
I need the search engine on a site I am building at the moment to display the searc
help with mysql_error()
Hi,
I am trying to insert data into a table, but I am not able to insert it. I wanted to see
How to search for several parameters from objects in a database?
I have a database with lots of information about objects.
Now I would like to search for 4 or 5 p
Warning: session_start() [function.session-start]: Cann.....
hi, can someone help me with this? I keep getting this error....
Warning: session_start() [fu
'210010106140040100' == '210010106140040101'
Debugging this simple line of a PHP script
Code: if($a == $b){ }
I've found that with val
Problem!
I have another problem, when i run this code i get this error "Parse error: syntax error, unexp