stencilz Posted January 28, 2007 Report Share Posted January 28, 2007 (edited) varbūt skanees drusku nesakarīgi :) ir piecas kolonnas column1,column2,column3,column4,column5. dažas no tām ir teksts dažas ir tukšas. vai ar vienu kveriju var panākt lai padotā informācija ievietojas vienā no tukšajām kolonnām? kaut kas it kā sanāk ar šādu kveriju mysql_query("UPDATE table SET column_1='".$_GET['add']."' OR column_2='".$_GET['add']."' OR column_3='".$_GET['add']."' OR column_4='".$_GET['add']."' OR column_5='".$_GET['add']."' WHERE column_1='' OR column_2='' OR column_3='' OR column_4='' OR column_5=''"); bet datubāzee saglabājas nevis tas ko vajag bet 0 it kā radās vēl viena doma if($column['column_1'] == "") { mysql_query("UPDATE table SET column_1='".$_GET['add']."' WHERE user_name='".$user."'"); } if($column['column_2'] == "") { mysql_query("UPDATE table SET column_2='".$_GET['add']."' WHERE user_name='".$user."'"); } if($column['column_3'] == "") { mysql_query("UPDATE table SET column_3='".$_GET['add']."' WHERE user_name='".$user."'"); } if($column['column_4'] == "") { mysql_query("UPDATE table SET column_4='".$_GET['add']."' WHERE user_name='".$user."'"); } if($column['column_5'] == "") { mysql_query("UPDATE table SET column_5='".$_GET['add']."' WHERE user_name='".$user."'"); } tikai kā varētu likt neizpildīties pārējiem if, ja info jau ir ievietota? Edited January 28, 2007 by stencilz Link to comment Share on other sites More sharing options...
Delfins Posted January 28, 2007 Report Share Posted January 28, 2007 Brrr.... murgs... Nopērc kādu grāmatu par SQL Link to comment Share on other sites More sharing options...
stencilz Posted January 28, 2007 Author Report Share Posted January 28, 2007 nekas, atrisināju problēmu Link to comment Share on other sites More sharing options...
Recommended Posts