Im cleaning up the source of a project I did. Learning php/mysql as I go. I realized with select you can select more then one table. (duh -_-) tablea.field1,tableb.field2 etc. You old schoolers know what i mean. I think with update you can as well. But can this be done with Insert? $sql="INSERT INTO table1 (f1, f2, f3)VALUES('$1', '$2', '$3')" or die(mysql_error()); $query=mysql_query($sql); $sql="INSERT INTO table2 (f1, f2, f3)VALUES('$1', '$2', '$3')" or die(mysql_error()); $query=mysql_query($sql); PHP: Have that in one? I cant see how its possible and google is not telling me much. I did try for about an hour. Im tired now. Any help is appreciated
It also can be done with the insert as well e.g. $sql="INSERT INTO table1 (f1, f2, f3)VALUES('$1', '$2', '$3'), ('$1', '$2', '$3')"; $query=mysql_query($sql) or die(mysql_error()); PHP:
do you mean $sql="INSERT INTO table1,table2 (f1, f2, f3),(f1, f2, f3)VALUES('$1', '$2', '$3'), ('$1', '$2', '$3')"; $query=mysql_query($sql) or die(mysql_error()); PHP: I think you do. woot. makes things alot easier and cleaner. thanks