| | |
$rs=mysql_query($sql) or die("error in common.inc.php at line 257");
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2005
Posts: 3
Reputation:
Solved Threads: 0
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]?>¤t_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>
<?
}
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]?>¤t_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>
<?
}
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.
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.
![]() |
Similar Threads
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result (PHP)
- Parse error, unexpected T_STRING on line 26, but I don't see it (PHP)
- Another mysql_num_rows(): error (PHP)
- parser error saying '='..plz help me... (PHP)
- PHP/SQL query help (PHP)
- Problem with foreach when using linking (PHP)
- I need help with a parse error! (PHP)
- DB-Authentication php/mysql on Mac OSX v3 (PHP)
Other Threads in the PHP Forum
- Previous Thread: Another mysql_num_rows(): error
- Next Thread: how to detect the username sharing by IP address?
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql navigation number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white xml youtube





