|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Duplicate Rows
This is how I check for duplicate rows:
$query="SELECT * FROM tablename WHERE number=$id AND yr=$yr"; $result=mysql_query($query,$db); $num = mysql_affected_rows(); if($num>0) { echo "Error: Row already exists."; } What is the correc way to do this? |
|
#2
|
|||
|
|||
|
RE: Duplicate Rows
mysql_affected_rows does not work with SELECT statements. Instead, you should use mysql_num_rows. But, yes, other than that it looks good.
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Duplicate Rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|