hi thank you very much Halojoy
I did as you had suggested and thank you that part of it worked for me, now I can get the into the script and the site, and now I see these 2 new sets of errors I am using the php designer 2005 version here as well as the notepad ++ version on my
pc here and I copied your code there into the notepad++ part then FTP'ed it over
once more to my site and as I said thank you thus far for that fix as it got me in.
Please if I can post this next error message here for this code into this post so
that if you will be so kind as to further assist me I would surely appreciate it, I have been trying on my own here for well over 6 hours thus far and getting no where.
so here is this next error message I am getting:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxxxxxx/public_html/xxxxxx/sql.php on line 48
here is the php code for this page as well:
<?php
include_once ('config.php');
global $db_list;
$db_list['db_name']=$USER_VAR['SQL_DB'];
$db_list['article']="xxx_articles";
$db_list['tags']="xxx_sourcetags";
$db_list['search']="xxx_search";
$db_list['cat_***********']="asb_cat_***********";
$db_list['cat_*************']="asb_cat_*************";
$db_list['cat_**********']="asb_cat_**********";
function aconnect(){
global $db_list;
global $USER_VAR;
//$password="test123";
// Connect with the mySQL database
if (!$link = mysql_connect($USER_VAR['SQL_HOST'], $USER_VAR['SQL_USER'], $USER_VAR['SQL_PASS']))
{ echo mysql_error()."<br>";
die ("Could not connect");
return 0;
}
////print ("Connected successfully");
if (!mysql_select_db ($USER_VAR['SQL_DB']))
{echo mysql_error()."<br>";
die ("Could not select database");
return 0;
}
//echo "Connected!<br>";
return 1;
}
// Put search info into DB
function put_search_info($info)
{global $db_list;
//print_r($info);
$query = "INSERT INTO `".$db_list['search']."` (`total`, `output_dir`, `cat_ac`, `cat_ga`, `article_temp`, `index_temp`, `index_size`, `link_size`, `filter`) VALUES ('".$info['total']."', '".$info['output_dir']."', '".$info['cat_ac']."', '".$info['cat_ga']."', '".$info['article_temp']."', '".$info['index_temp']."', '".$info['index_size']."', '".$info['link_size']."', '".$info['filter']."')";
if (!doQuery($query))
{echo "Data not inserted into ".$db_list['search'].".<br>";//".$query."<br>";
return 0;
}
else return 1;
}//END put search info
function get_templates()
{aconnect();
global $db_list;
$query = "SELECT `article_temp`,`index_temp` FROM `".$db_list['search']."` LIMIT 0,100000";
doQuery($query);
global $result;
if (mysql_num_rows ($result)=="0"){return FALSE;}
while($res=mysql_fetch_array($result))
{//print_r($res);
//echo $res[0]."<br>";
$art[].=$res[0];
//echo $res[1]."<br>";
$ind[].=$res[1];
}
$full=array($art,$ind);
return $full;
}
// Write article info to the 'article' DB.
function put_article ($article_info)
{
// An array of the DB names
global $db_list;
//FIRST LOOK FOR URL in DB:
$query="SELECT `url` FROM `".$db_list['article']."` WHERE `url` = '".addslashes($article_info['url'])."'";
doQuery($query);
global $result;
$res=mysql_fetch_array($result);
if ($res[0]==addslashes($article_info['url'])){return;}
else {
$query = "INSERT INTO `".$db_list['article']."` (`url` , `title` , `author` , `article` , `resource_box`)
VALUES (
'".addslashes($article_info['url'])."', '".addslashes($article_info['title'])."', '".addslashes($article_info['author'])."', '".addslashes($article_info['text'])."', '".addslashes($article_info['resource_box'])."'
);";
if (!doQuery($query))
{echo "Data not inserted into ".$db_list['article'].".<br>";//".$query."<br>";
return 0;
}
else return 1;
}
}// END put_article
function get_sql ($query)
{//echo $query;
if (!$sql_res = mysql_query($query))
{echo "There was an error: <br>".mysql_error()."<br>";
return false;}
else return $sql_res;
}
function doQuery($query)
{
global $result;
////print"<br>++++++<br>".$query."<br>++++++<br>";
if (!$result = mysql_query($query))
{//echo ("doquery");
echo mysql_error().'<br><b>'.$query.'</b>';
return 0;
}
return 1;
}
function getRow($id)
{
aconnect();
$query=" SELECT *
FROM aa
WHERE id='$id'";
//echo $query;
if (!$result = mysql_query($query))
{
echo mysql_error().'<br>';
return 0;
}
return mysql_fetch_assoc($result);
}
?>
I hope i got this part of it right to enter this coding in this time around?
Also thank you very much laserlight for your post and help into this as well
the global part I did try but that did not seem to get me in until I copied halojoys
code here and that did work for me.
I sure hope you can further be so kind as to assist me with this , and thank you
so very much once again even that simple little code that you posted here as I said has taken me a bit further into this script.
I also seem to have one more issue after this one but I do not want to confuse
those who can further help me get this code issue sorted first before I post the next part of code issue and similar error message as the one here only that one
is in the index .php file.
I hope I explained this alright thus far
Libby