virtuexru Posted March 11, 2009 Share Posted March 11, 2009 OK, so I have populated a table, I was wondering if I can run this to check if the table DOESNT have a certain ID number, then an update function can add a new row, is this coherent or am I retarded? Here is my code: <?php $ListQuery = "SELECT * FROM relist where vid='".addslashes($tlist[7])."'"; $ListQueryRS = mysql_query($ListQuery); $TotList = mysql_num_rows($ListQueryRS); if($TotList>0) { mysql_query("UPDATE relist SET newdate = '".$AuctionDate."' WHERE vid = '".addslashes($tlist[7])."'"); } else { mysql_query("UPDATE relist SET id='', vid = '".addslashes($tlist[7])."', origdate='".$AuctionDate."', newdate='".$AuctionDate."'"); } ?> Link to comment https://forums.phpfreaks.com/topic/148950-my-query-woes-updating-into-a-blank-row/ Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html Link to comment https://forums.phpfreaks.com/topic/148950-my-query-woes-updating-into-a-blank-row/#findComment-782098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.