PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old September 22nd, 2002, 07:51 PM
justravis justravis is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 65 justravis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 12 sec
Reputation Power: 2
Send a message via AIM to justravis Send a message via Yahoo to justravis
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?

Reply With Quote
  #2  
Old September 22nd, 2002, 11:01 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Duplicate Rows


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway