You are here: Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL « PHP Language « IT news, forums, messages
Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL

Posted by hackajar on 12/25/06 10:37

$sql = mysql_query("SELECT C_USER_NAME FROM CUSTOMER where
C_USER_NAME = '$cus[8]'", $link);

Replace above with this:
$query = "SELECT C_USER_NAME FROM CUSTOMER where
C_USER_NAME = '".$cus[8]."';"; //NOTE: brack out of quotes when
referencing Array hash elemets ;)
$result = mysql_query($query) or die(mysql_error());

-Hackajar
jay2006 wrote:
> Hi,
>
> I keep getting this error after registration, does anyone know the fix?
> Thanks.
>
>
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL
> result resource in /insert.php on line 117
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /insert.php:117)
> in /insert.php on line 128
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /insert.php:117)
> in /insert.php on line 129
>
>
> if($num3 != 0)
> {
> $msg = ("<b>Email Already Registered:</b><br>We are sorry but the
> email you have entered has already been registered, please use another
> or try to recover your previous account.");
> mysql_close($link);
> }
> else
> {
> $sql = mysql_query("SELECT C_USER_NAME FROM CUSTOMER where
> C_USER_NAME = '$cus[8]'", $link);
> line 117>>> $num = mysql_num_rows($sql);
>
> if($num != 0)
> {
> $msg = ("<b>Username Already In Use:</b><br>We are sorry but the
> username you have chosen has already been taken. Please go back and try
> another or add numbers to make it unique.");
> mysql_close($link);
> }
> else
> {
> mysql_query("INSERT INTO customer (C_TITLE, C_FNAME, C_SNAME,
> C_ADDRESS, C_ADDRESS2, C_TOWN, C_COUNTY, C_PCODE, C_TEL_NUM, C_EMAIL,
> C_PWORD, C_USER_NAME, C_KEY, C_SECRET_A, C_SECRET_Q, C_MAIL_TYPE)
> values
> (UPPER('$cus[0]'),UPPER('$cus[1]'),UPPER('$cus[2]'),UPPER('$cus[3]'),UPPER('$add2'),UPPER('$cus[4]'),UPPER('$cus[5]'),UPPER('$cus[6]'),'$cus[7]',LOWER('$email'),'$pword','$cus[8]','$cUsername','$cus[10]','$cus[9]','$type')",
> $link);
> mysql_close($link);
> setcookie("key:", $cUsername, time()+300); // sets cookie
> header("Location: activate.php"); // directs to activation script*/
> }
> }
> }

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация