You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''userinfo' where name =' at line 1
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\PHPPro\add1.php on line 15
<?php
$host = "localhost";
$user = "root";
$password = "4580849";
$dbname = "register";
mysql_connect($host,$user,$password) or die ("ติดต่อ Host ไม่ได้");
mysql_select_db($dbname) or die ("ติดต่อฐานข้อมูลไม่ได้");
$sql = "insert into 'userinfo' ('name','gender','tel')
values ('$name','$gender','$tel')";
mysql_query("set NAMES tis620");
$sqlquery= mysql_db_query($dbname, $sql);
$checkadd = "select * from 'userinfo' where name = $name";
$result = mysql_db_query($dbname,$checkadd);
echo mysql_error();
$num=mysql_num_rows($result);