$rs=mysql_query($sql) or die("error in common.inc.php at line 257");

Reply

Join Date: Mar 2005
Posts: 3
Reputation: oracle4me is an unknown quantity at this point 
Solved Threads: 0
oracle4me oracle4me is offline Offline
Newbie Poster

$rs=mysql_query($sql) or die("error in common.inc.php at line 257");

 
0
  #1
Jun 17th, 2005
Hello please help

Total php beginner please help i am going crazy
my home-page opens finishes loading but with error's on page and my hitcounter does not display on my site but it's still logging my site

I looked through my site files and found this error below.
Is this the problem i hope please help me everything is so complex for me to understand alone: thanks so much

$sql="select * from links_location where location='l'";

$rs=mysql_query($sql) or die("error in common.inc.php at line 257");

while($rec=mysql_fetch_array($rs))


This is my hitcounter stat.php file
<?

include("include/common.inc.php");

global $Call;

switch($Call)

{

case"":

start_stats();

break;



case"show_pages":

show_pages();

break;

}





function start_stats()

{

global $load_url,$title,$current_sid,$REMOTE_ADDR,$ip_address,$resolution,$color_depth,$browser,$platform,$countryName,$visited_from,$member_id,$hit_counter,$done,$url;

$sqls="select counter from counter where member_id=$member_id";

$rss=mysql_query($sqls) or die("error");

if(mysql_numrows($rss)>0)

{

$recs=mysql_fetch_array($rss);

$hit_counter=$recs[0]+1;



}

else

{

$hit_counter=0;

}





if(empty($current_sid))

{

$sql="select * from counter where member_id=$member_id";

$rs=mysql_query($sql) or die("Unable to check the existence of member");

if(mysql_numrows($rs)>0)

{



$sql="Update counter set counter=counter+1 where member_id=$member_id";

mysql_query($sql) or die("Unable to update counter.");

}

else

{

$sql="insert into counter values($member_id,1)";

mysql_query($sql) or die("Unable to update counter.");

}





$ip_address=$REMOTE_ADDR;

$ip_address=$REMOTE_ADDR;

get_country();

$last_login=getmysqldate(getukdate(date("Y-m-j")));

$time=date("G:i:s");

$last_login=$last_login." ".$time;

$sql="insert into visitor_stats values('',$member_id,\"$ip_address\",\"$last_login\",\"$resolution\",\"$color_depth\",\"$browser\",\"$platform\",\"$visited_from\")";

mysql_query($sql) or die("Unable to make log of login .");







}

if(empty($current_sid))

{

$current_sid=session.session_id();

session_register("current_sid");

}







?>



<script language='JavaScript' src='<?=$url?>authorization.js'>

</script>

<form name='frm' method='post' action='stat.php'>

<input type='hidden' name='Call' value='show_pages'>

<input type='hidden' name='load_url' value='<?=$load_url?>'>

<input type='hidden' name='title' value='<?=$title?>'>

<input type='hidden' name='current_sid' value='<?=$current_sid?>'>

<input type='hidden' name='REMOTE_ADDR' value='<?=$REMOTE_ADDR?>'>

<input type='hidden' name='ip_address' value='<?=$ip_address?>'>

<input type='hidden' name='resolution' value='<?=$resolution?>'>

<input type='hidden' name='color_depth' value='<?=$color_depth?>'>

<input type='hidden' name='browser' value='<?=$browser?>'>

<input type='hidden' name='platform' value='<?=$platform?>'>

<input type='hidden' name='countryName' value='<?=$countryName?>'>

<input type='hidden' name='visited_from' value='<?=$visited_from?>'>

<input type='hidden' name='member_id' value='<?=$member_id?>'>

<input type='text' name='hit_counter' value='<?=$hit_counter?>'>

<input type='hidden' name='done' value='<?=$done?>'>

</form>









<?

if(empty($done))

{

$done="no";

?>

<script language='javascript'>

frm.submit();

</script>

<?

}





}



function show_pages()

{

global $HTTP_POST_VARS,$done,$url;



?>

<FRAMESET rows='0,*' frameborder='no' scrolling=no MARGINWIDTH=0 MARGINHEIGHT=0>

<FRAME SRC='<?=$url?>stat.php?member_id=<?=$HTTP_POST_VARS[member_id]?>&current_sid=<?=$HTTP_POST_VARS[current_sid]?>&done=<?=$HTTP_POST_VARS[done]?>' scrolling=no MARGINWIDTH=0 MARGINHEIGHT=0 name='frame1' noresize>

<FRAME SRC='<?=$HTTP_POST_VARS[load_url]?>' name='frame2' noresize>

</FRAMESET>

<?

}
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: $rs=mysql_query($sql) or die("error in common.inc.php at line 257");

 
0
  #2
Jun 17th, 2005
Please read and follow Paradox814's post at this thread:
http://www.daniweb.com/techtalkforums/thread25821.html

It will show you some basics of running mysql queries in PHP along with how to read the mysql errors. Use the techniques shown to modify how you run your queries. Create a page that only has the problem--nothing else. Keep the chunk you are working on as small as possible. When you get it working, add one step to it, and test again.

Enjoy the journey.
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC