![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
sungpeng
-
Posts
290 -
Joined
-
Last visited
Posts posted by sungpeng
-
-
<?php
include 'config2.php';
$counted=setcookie("user", "mydomain", time()+60*60*60); if($counted==""){ setcookie("counter","counted",time()+60*60*60); mysql_query("UPDATE stats SET counter=counter+1 where id='0'"); }
The above code intended to track the number of new customers visiting my webpages. It is not working, can anyone help to correct it?
-
and if I want to count the number of time per visitor hit the pages using $_cookie, how to code?
$going =$_SERVER["REMOTE_ADDR"]; setcookie("user", "$going");
-
$going =$_SERVER["REMOTE_ADDR"]; $time=date(y).date(m).date(d).date(h).date(i).date(s); $str="INSERT INTO track(chtime,visitor,pages) values ('$time','$going','index')" ; mysql_query($str) or die('Error insert query failed');
The above code will track the user IP address whenever a visitor hit my pages. Can check how to stop repeated visitors from activate the above code or if refresh button is hit, the above code will not activate. It will work only work once to get exact number of new visitor.
-
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />"; mysql_query("SET character_set_client=utf8", $dbLink); mysql_query("SET character_set_connection=utf8", $dbLink); $update_pdt=mysql_query("update instructor set description='$_POST[description]' where pid=$_GET[pid]", $dbLink);
-
ok I tried to do according to the above, now even my window xp set to chinese PRC also cannot view.. All I get is ???
-
ya my database is UTf-8. but if my window xp don't set to chinese languages PRC. it cannot view character from the database.
-
$result = mysql_query("SELECT * FROM comlistings) or die ("Query failed"); while ($row = mysql_fetch_array($result)) { $district=$row[district]; echo "$row[district]"; }
My data retrieve is normal one
-
<? $hostname = "localhost"; $username = "hello"; $password = "fefa"; $dbName = "sgfai_property"; MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database"); mysql_select_db("$dbName") or die("Unable to select database"); ?>
like say I need to insert this 级搜索 into mysql, it will turn out character that cannot read.
-
<?php if($_POST[action]=="Submit") { include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php"); $loginname=$_POST["loginname"]; $insert_student=mysql_query("insert into users (loginname) values ('$loginname'"); ?> }else{ ?> <html> <head> <title></title> </head> <body> <table width="400" align="center"> <br> <form name="form" action="<?php echo "$PHP_SELF"; ?>" method="post"> <tr> <td width="35%">Loginname</td> <td><input type="text" name="loginname" size="25"></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" name="action" value="Submit"></td> </tr> </table> </form> </body> </html> <?php } ?>
Hi checking when I input chinese character into "loginname" field using the above code. The chinese character turn out not able to read. Is there a special code for input chinese character?
-
and can tip me if 75, 76, 78 ,79 is occupied, I want the new entry to insert into 77 empty row, is it possible from php. If like that increment, it can go up to 10000.
-
ya revraz, I do access phpmyadmin, but which button and where? I delete 79,80,81,82, the number still run from 83. It does not go back to 79.
-
mysql set auto-increment keep on running up.. 80, 81, 82, 83.. like say I need it to start running from specific number like start running from 20, 21 ,22, 23 how should I command?
-
<?php mail("sung@hotmail.com", "$emailsubject", "Dear $fname $lname, Thank you for registering. Below you will find your username and password that will let you log in and begin to enter rental listings. Username: $email Password: $newpass ", "FROM:sgfair.com"); ?>
Hi the above script will sent an e-mail to the sung@hotmail.com. When it sent over an e-mail to another person, it's FROM "sgfair.com" (sgfair@yourhostingnet.com). Can the FROM just show "sgfair.com" without the sgfair@yourhostingnet.com?
-
Finally got it working before it drive me mad. Thank Zanus and Dadamssg.
-
It cannot insert into mysql.
-
die (mysql_error());
Result :
Duplicate entry '' for key 1
-
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home2/sgfairde/public_html/housing/agentsignup.php on line 22
-
it keep giving me "Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /home2/sgfairde/public_html/housing/agentsignup.php on line 21" but I don't see there is anything wrong?
-
<?php if($_POST[action]=="Submit") { $hostname = "localhost"; $username = "sgfai_winning"; $password = "helly"; $dbName = "sgfai_property"; MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database"); mysql_select_db("$dbName") or die("Unable to select database"); $loginname=$_POST[loginname]; echo "$loginname"; $result=mysql_query("insert into users (loginname) values ('$loginname')") or die (mysqli_error($result)); } ?> <html> <head> <title>Agents Register</title> </head> <body> <table width="400" align="center"> <br> <form name="form" action="<?php echo"$PHP_SELF"; ?>" method="post"> <tr> <td width="35%">Loginname</td> <td><input type="text" name="loginname" size="25"></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" name="action" value="Submit"></td> </tr> </table> </form> </body> </html>
-
oh.. all my pages cannot work already... just now only the insert pages, now all other pages cannot work
-
<? $hostname = "localhost"; $username = "sgfai_winning"; $password = "heally"; $dbName = "sgfai_property"; MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database"); mysql_select_db("$dbName") or die("Unable to select database"); ?>
Hi zanus, is the above connection wrong?
-
ok it still giving me "Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /home2/sgfairde/public_html/housing/agentsignup.php on line 21"
-
<?php if($_POST[action]=="Submit") { include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php"); $loginname=$_POST[loginname]; echo "$loginname"; $result=mysql_query("insert into users (loginname) values ('$loginname')") or die (mysqli_error($result)); }else{ ?> <html> <head> <title>Agents Register</title> </head> <body> <table width="400" align="center"> <br> <form name="form" action="<?php echo"$PHP_SELF"; ?>" method="post"> <tr> <td width="35%">Loginname</td> <td><input type="text" name="loginname" size="25"></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" name="action" value="Submit"></td> </tr> </table> </form> </body> </html> <?php } ?>
-
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /home2/sgfairde/public_html/housing/agentsignup.php on line 21
[SOLVED] Track the number of new customers
in PHP Coding Help
Posted
hi masterace, can draft the code for me to see?